Skip to content

Commit

Permalink
Merge pull request #14 from Kuebler-IT/build_pipelines
Browse files Browse the repository at this point in the history
Initial enable github workflow and remove travis
  • Loading branch information
bkuebler authored Nov 25, 2023
2 parents 40d5145 + 79f5a07 commit ae861bb
Show file tree
Hide file tree
Showing 12 changed files with 320 additions and 37 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: Build on Ubuntu and macOS

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <MaxOS, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Release]
c_compiler: [gcc]
include:
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: macos-latest
c_compiler: gcc
cpp_compiler: g++

steps:
- uses: actions/checkout@v3

- name: Install dependencies on MacOS
if: matrix.os == 'macos-latest'
run: |
brew update
brew install autoconf automake libressl
- name: Install dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libssl-dev
- name: Configure Build
run: ./autogen.sh && ./configure

- name: Compile the Build
run: make

- name: Test
run: src/meshvpn | head -1
77 changes: 77 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '21 21 * * 2'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'c-cpp' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

- run: |
echo "Run, Build Application using script"
./autogen.sh && ./configure && make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![Build Status](https://travis-ci.org/Kuebler-IT/MeshVPN.svg?branch=master)](https://travis-ci.org/Kuebler-IT/MeshVPN)
[![BCH compliance](https://bettercodehub.com/edge/badge/Kuebler-IT/MeshVPN?branch=master)](https://bettercodehub.com/)
# MeshVPN

[![Build Status](https://github.com/github/docs/actions/workflows/main.yml/badge.svg)](https://github.com/Kuebler-IT/MeshVPN/actions)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/45808fccdbf14cd9a0b7738e06395750)](https://app.codacy.com/gh/Kuebler-IT/MeshVPN/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)

MeshVPN is a fork from PeerVPN to fix the not merged issues since a couple
of years. Some features are planned an will be updated in future.
Expand Down Expand Up @@ -44,11 +46,11 @@ in the sample meshvpn.conf that is bundled together with the program.

## Platforms & Dependencies

MeshVPN is available for Linux and FreeBSD. Additionally, one of the following
MeshVPN is available for Linux, MacOS and FreeBSD. Additionally, one of the following
crypto libraries is required:

- [LibreSSL](https://www.libressl.org) (recommended)
- [OpenSSL](https://www.openssl.org) 1.0.X (note: the 1.1.x has incompatible API changes)
- [LibreSSL](https://www.libressl.org) (recommended)
- [OpenSSL](https://www.openssl.org)

## License

Expand Down
9 changes: 5 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ dnl Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])

AC_INIT([MeshVPN], [1.0.0-alpha.1], [[email protected]])
AC_INIT([MeshVPN], [1.1.0-alpha.1], [[email protected]])

# Platform specific settings
AC_CANONICAL_HOST
case $host_os in
darwin* )
# Do something specific for mac
LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS"
CPPFLAGS="-I/usr/local/opt/openssl/include $CPPFLAGS"
LDFLAGS="-L/usr/local/opt/libressl/lib $LDFLAGS"
CPPFLAGS="-I/usr/local/opt/libressl/include $CPPFLAGS"
;;
linux*)
# Do something specific for linux
Expand All @@ -55,7 +55,8 @@ AC_PROG_INSTALL

# Checks for libraries.
AC_CHECK_LIB([z], [compress])
AC_CHECK_LIB([ssl], [SSL_library_init])
AC_CHECK_LIB([ssl], [SSL_library_init]) # old openssl or compatible library like libressl
AC_CHECK_LIB([ssl], [OPENSSL_init_ssl]) # we have openssl also newer version
AC_CHECK_LIB([crypto], [ENGINE_init])
AC_CHECK_LIB([seccomp], [seccomp_init])

Expand Down
6 changes: 6 additions & 0 deletions include/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@

// cipher context storage
struct s_crypto {
#if OPENSSL_VERSION_NUMBER < 0x10100000L
EVP_CIPHER_CTX enc_ctx;
EVP_CIPHER_CTX dec_ctx;
HMAC_CTX hmac_ctx;
#else
EVP_CIPHER_CTX *enc_ctx;
EVP_CIPHER_CTX *dec_ctx;
HMAC_CTX *hmac_ctx;
#endif
};


Expand Down
23 changes: 12 additions & 11 deletions include/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,20 @@ struct s_initpeers {
struct s_io_addr * addresses;
int count;
};

// global variables
struct s_io_state iostate;
struct s_p2psec * g_p2psec;
int g_mainloop;
extern struct s_io_state iostate;
extern struct s_p2psec * g_p2psec;
extern int g_mainloop;

struct s_switch_state g_switchstate;
struct s_ndp6_state g_ndpstate;
struct s_virtserv_state g_virtserv;
extern struct s_switch_state g_switchstate;
extern struct s_ndp6_state g_ndpstate;
extern struct s_virtserv_state g_virtserv;

int g_enableconsole;
int g_enableeth;
int g_enablendpcache;
int g_enablevirtserv;
int g_enableengines;
extern int g_enableconsole;
extern int g_enableeth;
extern int g_enablendpcache;
extern int g_enablevirtserv;
extern int g_enableengines;

#endif
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ meshvpn_SOURCES = \
platform/seccomp.c \
platform/perms.c \
platform/ifconfig.c \
app/globals.c \
app/init.c \
app/loop.c \
app/config.c \
Expand Down
43 changes: 43 additions & 0 deletions src/app/globals.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* MeshVPN - A open source peer-to-peer VPN (forked from PeerVPN)
*
* Copyright (C) 2012-2016 Tobias Volk <[email protected]>
* Copyright (C) 2016 Hideman Developer <[email protected]>
* Copyright (C) 2017 Benjamin Kübler <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef F_GLOBALS_C
#define F_GLOBALS_C

#include "io.h"
#include "p2p.h"
#include "ethernet.h"

struct s_io_state iostate;
struct s_p2psec * g_p2psec;
int g_mainloop;

struct s_switch_state g_switchstate;
struct s_ndp6_state g_ndpstate;
struct s_virtserv_state g_virtserv;

int g_enableconsole;
int g_enableeth;
int g_enablendpcache;
int g_enablevirtserv;
int g_enableengines;

#endif
Loading

0 comments on commit ae861bb

Please sign in to comment.