Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded solutions support #830

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/openfortivpn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
run: sudo apt-get install -y astyle

- name: Artistic Style
run: ./tests/lint/astyle.sh $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation)
run: ./tests/lint/astyle.sh $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation | grep -v ifaddrs)

- name: Linux Kernel Coding Style
run: ./tests/lint/checkpatch.sh $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation)
run: ./tests/lint/checkpatch.sh $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation | grep -v ifaddrs)

- name: EOL at EOF
run: ./tests/lint/eol-at-eof.sh $(git ls-files | grep -v openssl_hostname_validation)
run: ./tests/lint/eol-at-eof.sh $(git ls-files | grep -v openssl_hostname_validation | grep -v ifaddrs)

- name: Line Length
run: ./tests/lint/line_length.py $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation)
run: ./tests/lint/line_length.py $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation | grep -v ifaddrs)

build:
name: Build
Expand Down
4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ openfortivpn_SOURCES = src/config.c src/config.h src/hdlc.c src/hdlc.h \
src/xml.h src/userinput.c src/userinput.h \
src/openssl_hostname_validation.c \
src/openssl_hostname_validation.h
if LIBREPLACE_REQUIRED
openfortivpn_SOURCES += src/ifaddrs.c
endif
openfortivpn_CFLAGS = -Wall -pedantic
openfortivpn_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" \
-DPPP_PATH=\"@PPP_PATH@\" \
-DNETSTAT_PATH=\"@NETSTAT_PATH@\" \
Expand Down
88 changes: 68 additions & 20 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ AC_TYPE_UINT8_T
AC_CHECK_TYPES([struct termios], [], [], [#include <termios.h>])

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([ \
access \
atoi \
Expand All @@ -125,15 +123,13 @@ fputs \
fread \
free \
freeaddrinfo \
freeifaddrs \
freopen \
fwrite \
gai_strerror \
getaddrinfo \
getchar \
getenv \
geteuid \
getifaddrs \
getopt_long \
htons \
index \
Expand Down Expand Up @@ -320,26 +316,34 @@ AS_IF([test "x$enable_proc" = "x"], [
# check for ppp if not specified
AC_PATH_PROG(PPP, [ppp], [/usr/sbin/ppp], "$PATH:/sbin:/usr/sbin")
AS_IF([test "x$PPP_PATH" = "x"], [
AC_CHECK_FILE([$PPP], [
AS_IF([test "x$PPP_PATH" = "x"], [
PPP_PATH="$PPP"
])
AS_IF([test "x$with_ppp" = "x"], [
with_ppp="yes"
])
],[])
if test "$cross_compiling" = "yes"; then
AC_MSG_NOTICE([Cross compiling, ommited PPP path check])
else
AC_CHECK_FILE([$PPP], [
AS_IF([test "x$PPP_PATH" = "x"], [
PPP_PATH="$PPP"
])
AS_IF([test "x$with_ppp" = "x"], [
with_ppp="yes"
])
],[])
fi
mobrembski marked this conversation as resolved.
Show resolved Hide resolved
])
# check for pppd if not specified
AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], "$PATH:/sbin:/usr/sbin")
AS_IF([test "x$PPP_PATH" = "x"], [
AC_CHECK_FILE([$PPPD], [
AS_IF([test "x$PPP_PATH" = "x"], [
PPP_PATH="$PPPD"
])
AS_IF([test "x$with_pppd" = "x"], [
with_pppd="yes"
])
],[])
if test "$cross_compiling" = "yes"; then
AC_MSG_NOTICE([Cross compiling, ommited PPP path check])
else
AC_CHECK_FILE([$PPPD], [
AS_IF([test "x$PPP_PATH" = "x"], [
PPP_PATH="$PPPD"
])
AS_IF([test "x$with_pppd" = "x"], [
with_pppd="yes"
])
],[])
fi
])
# when neither ppp nor pppd are enabled fall back to a sensible choice for the platform
AS_IF([test "x$with_ppp" = "x" -a "x$with_pppd" = "x"], [
Expand Down Expand Up @@ -487,6 +491,50 @@ int main(int argc, char **argv){
AC_MSG_NOTICE([HAVE_SO_BINDTODEVICE... 0])
])

AC_ARG_WITH([resolvconf-config-file],
AS_HELP_STRING([--with-resolvconf-config-file],
[Set the path to the resolv.conf config file. \
Default is /etc/resolv.conf.]),
AC_DEFINE_UNQUOTED([RESOLV_CONF_FILE_PATH],["$withval"])
)

AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <netdb.h>
int main(int argc, char **argv){
struct ifaddrs *ifp = NULL;
int ret = getifaddrs (&ifp);
freeifaddrs(ifp);
}
])], [
libreplace_required=no
AC_MSG_NOTICE([HAVE_IFADDRS... 1])
],[
libreplace_required=yes
AC_MSG_NOTICE([HAVE_IFADDRS... 0])
])

AC_ARG_ENABLE([libreplace],
[AS_HELP_STRING([--enable-libreplace], [Force to use libreplace ifaddrs implementation])],
[enable_libreplace=yes],
[enable_libreplace=no])
AS_CASE(["$enable_libreplace"],
[yes], [
AC_MSG_NOTICE([Force using libreplace...])
],
[no], [
],
[AC_MSG_ERROR([unknown option '$enable_libreplace' for --enable-libreplace])])
AS_IF([test "x$enable_libreplace" != "xno" -o "x$libreplace_required" != "xno"], [AC_DEFINE([HAVE_IFADDRS],[0])], [AC_DEFINE([HAVE_IFADDRS],[1])])
AM_CONDITIONAL([LIBREPLACE_REQUIRED], [test "x$enable_libreplace" = "xyes" -o "x$libreplace_required" = "xyes"])

# prepare to get rid of obsolete code (FortiOS 4)
AC_ARG_ENABLE([obsolete],
Expand Down
Loading