Commit Graph
735 Commits
Author SHA1 Message Date
khorben a7a9ecb991 Add the fw_command6 member to the right struct fw_config 2018-08-20 11:02:16 +02:00
khorben edeea235bc Add a configuration variable for IPv6 firewall binaries
This is only relevant for iptables at the moment.
2018-08-20 11:02:16 +02:00
khorben 956e1df228 Allow the longest possible IPv6 address in sources 2018-08-20 11:02:16 +02:00
khorben e29d62ef10 Fix build with NFQ enabled 2018-08-20 11:02:16 +02:00
khorben 9923fc0a88 Verify if the protocol family matches incoming packets 2018-08-20 11:02:16 +02:00
khorben 13dee2cdd8 Support further address families in the future 2018-08-20 11:02:16 +02:00
khorben bbb341c040 Fix the build with firewalld 2018-08-20 11:02:16 +02:00
khorben 15dfc94e9c Fix the build on Linux (iptables) 2018-08-20 11:02:16 +02:00
khorben 6405398858 Add a command-line option to enable IPv6 (TCP/UDP)
This is currently "--ipv6", or "-6" for short.
2018-08-20 11:02:16 +02:00
khorben 1fd5fe197d Begin to allow IPv6 addresses in source stanzas 2018-08-20 11:02:16 +02:00
khorben 987875616a Fix some issues with TCP over IPv6 2018-08-20 11:02:16 +02:00
khorben 3e329a537d Correct the packet length calculation with IPv6 2018-08-20 11:02:16 +02:00
khorben c8670aa2d3 Simplify the calculation of pkt_data_len 2018-08-20 11:02:16 +02:00
khorben d260f502d9 Use the correct offset for inet_ntop() 2018-08-20 11:02:16 +02:00
khorben c753215038 Prepare access stanzas for more address families 2018-08-20 11:02:16 +02:00
khorben 74370395a7 Constify 2018-08-20 11:02:15 +02:00
khorben f35c1d7cb7 Add IPv6 support to the plain UDP and TCP servers 2018-08-20 11:02:15 +02:00
khorben 32cdd1183e Specify the family at run-time for TCP/UDP servers
This is still using IPv4 by default for the moment.
2018-08-20 11:02:15 +02:00
khorben d6ce22b989 Set the address family for incoming SPA over UDP 2018-08-20 11:02:15 +02:00
khorben 587a4fbcb1 Rework IPv6 support when comparing addresses 2018-08-20 11:02:15 +02:00
khorben da1ab0563d Use a constant for AF_INET
This should eventually help with portability to IPv6.
2018-08-20 11:02:15 +02:00
khorben b070e80623 Use sizeof() instead of re-using hard-coded values
This should help with portability for the protocol family eventually.
2018-08-20 11:02:15 +02:00
khorben f61a3085f0 Use sizeof() instead of re-using hard-coded values
This should help with portability for the protocol family eventually.
2018-08-20 11:02:15 +02:00
khorben baed23c50c Use AF_INET instead of PF_INET
I believe it should be more portable this way, since AF_INET is required
to be present in <sys/socket.h> in POSIX.
2018-08-20 11:02:15 +02:00
khorben d1c1373980 Allow access control "ANY" with any protocol family 2018-08-20 11:02:15 +02:00
khorben bd1c488cbd Typo 2018-08-20 11:02:15 +02:00
khorben 89c7d6f8b9 Let access list stanzas be defined in IPv6 2018-08-20 11:02:15 +02:00
khorben 8ecd10b4c0 Interpret incoming addresses according to their family 2018-08-20 11:02:15 +02:00
khorben 6bcaf4f3e3 Add support for receiving SPA messages over IPv6 2018-08-20 11:02:15 +02:00
khorben a525734afc Also include <netinet/ip6.h> where relevant 2018-08-20 11:02:15 +02:00
khorben 3dc61166a4 Rework the network listening routine some more 2018-08-20 11:02:15 +02:00
khorben ce9b5fb364 Rework the network listening routine 2018-08-20 11:02:15 +02:00
khorben b3494dcfc1 Migrate is_valid_ipv4_addr() to a more generic function
It is now called is_valid_ip_addr() and expects an additional parameter
for the address family.
2018-08-20 10:59:27 +02:00
Michael Rash 309abdab0c [server] Bug fix for MemorySanitizer error
Replace strlcpy() with memcpy() since the source buffer is not a string.
strlcpy() caught this anyway, but memcpy() usage is probably more valid.

==29766==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x562bc2e50420 in strlcpy /home/mbr/git/fwknop.git/common/strlcpy.c:61:3
    #1 0x562bc2e25362 in process_packet /home/mbr/git/fwknop.git/server/process_packet.c:225:5
    #2 0x7fa6173c9d57  (/lib64/libpcap.so.1+0x1fd57)
    #3 0x562bc2e2456a in pcap_capture /home/mbr/git/fwknop.git/server/pcap_capture.c:227:15
    #4 0x562bc2e13ef0 in main /home/mbr/git/fwknop.git/server/fwknopd.c:296:13
    #5 0x7fa61643724a in __libc_start_main /usr/src/debug/glibc-2.27-74-g68c1bf8097/csu/../csu/libc-start.c:308:16
    #6 0x562bc2d9dec9 in _start (/home/mbr/git/fwknop.git/server/.libs/fwknopd+0x1dec9)

  Uninitialized value was created by a heap allocation
    #0 0x562bc2da6c84 in malloc (/home/mbr/git/fwknop.git/server/.libs/fwknopd+0x26c84)
    #1 0x7fa6173ca996  (/lib64/libpcap.so.1+0x20996)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/mbr/git/fwknop.git/common/strlcpy.c:61:3 in strlcpy
2018-08-17 20:51:36 -04:00
Michael Rash 201d065f52 [server] fix Clang compiler warning to remove extraneous var increment
utils.c:217:13: warning: variable 'i' is incremented both in the loop header and in the loop
      body [-Wfor-loop-analysis]
            i++;
            ^
utils.c:213:34: note: incremented here
        for (i=0; i<strlen(str); i++)
2018-08-16 22:55:34 -04:00
Michael Rash 759965ee08 [server] fix UBSAN warning 'fwknopd.c:1044:50: runtime error: left shift of 2 by 30 places cannot be represented in type 'int'' 2018-08-10 21:22:23 -07:00
Michael Rash 71b8f22402 Merge pull request #282 from DeforaNetworks/khorben/execvp
Use execvp() instead of execvpe()
2018-08-08 17:05:55 -07:00
Michael Rash a6337ba054 Merge branch 'master' of ssh://github.com/mrash/fwknop 2018-08-06 20:41:09 -04:00
Michael Rash bd30379313 doc update 2018-08-06 17:27:52 -07:00
khorben 0b475ec7b3 Use execvp() instead of execvpe()
execvp() is (usually) equivalent to execvpe(), without enforcing any
change to the environment. However, unlike execvp(), execvpe() is not
standardized by POSIX, and may therefore not be available nor detected
when configuring the project (like on NetBSD).

No place could be found in fwknop to be using execvpe() and changing the
environment. Therefore it seems only logical (and safer) to use execvp()
instead.

This also updates the tests to reflect this change.
2018-08-06 12:04:45 +02:00
Michael Rash e0c860d2c7 Merge pull request #277 from DeforaNetworks/khorben/usage
More consistent usage screens
2018-07-18 21:28:48 -04:00
khorben 8a1289cdc9 More consistent usage screens 2018-07-17 16:45:46 +02:00
khorben 50f56a581f Fix the configuration variable name for GPG_DECRYPT_PW 2018-07-10 11:31:54 +02:00
khorben 5228fe88d0 Avoid compilation warnings from ctype(3) helpers
Characters should be casted as unsigned before use in functions from
<ctype.h>. Otherwise the compiler treats 8-bit characters (eg UTF-8) as
negative values (since it expects signed integers) and they no longer
match the comparison tables. Worse, the character 0xff gets interpreted
as -1 (like EOF). In turn, it helps to explicitly cast the result as a
signed integer, since this is what is expected. Characters in the range
0x80-0xff do keep their original values.

See the manual page for ctype(3) for more details (eg from NetBSD)
2018-06-12 14:01:22 -04:00
Michael Rash ecb25a042c regenerate fwknopd man page with Jonathan's pcap loop fix 2017-09-18 22:25:52 -04:00
Michael Rash be39f1a6f7 [server] call exit() upon execvpe() error, fixes #235 2016-10-10 20:38:38 -04:00
Michael Rash 836335ed41 [server] add strerror() to fopen() failures for the digest cache file 2016-10-09 09:35:17 -04:00
Michael Rash f5509bcd0c [server] Add MAX_FW_TIMEOUT to access.conf variables.
[server] Add MAX_FW_TIMEOUT to access.conf stanzas to allow a
maximum number of seconds for client-specified timeouts in SPA packets.
This fixes issue #226 which was spotted by Jeremiah Rothschild.
2016-09-29 22:18:13 -04:00
Markus Gerstel 2b365abcee fix spelling errors flagged by Debian lintian 2016-08-22 22:53:46 +01:00
Michael Rash 779029e8bb doc update 2016-06-08 20:38:40 -04:00