Commit Graph
751 Commits
Author SHA1 Message Date
khorben 3f3b304cf4 Port src_dst_check() to IPv6
The problem looks real, fix looks good to me, but have not been able to
reproduce the actual issue so far :(
2018-08-20 11:02:17 +02:00
khorben 46d4d77a66 Use "::/0" for IPT_ANY_IPV6 2018-08-20 11:02:17 +02:00
khorben f3895bb721 Fix DNAT with IPv6 2018-08-20 11:02:17 +02:00
khorben 73d7b7904b Use "::" for matching any address for IPv6 rules 2018-08-20 11:02:17 +02:00
khorben 561ba964f3 Resolve hostnames to IPv6 addresses in IPv6 mode 2018-08-20 11:02:16 +02:00
khorben 2bdaeff67d Default to IPv6 rules when listening on IPv6 2018-08-20 11:02:16 +02:00
khorben 0bbbd13d45 Code cleanup 2018-08-20 11:02:16 +02:00
khorben f97214bcfc Revert "Remove support for IPv6 for rules shared with IPv4"
This reverts commit d33c240070db98888bb960fe89fc5542f67f6fed.
2018-08-20 11:02:16 +02:00
khorben d28d1cb12d Add support for rule expiration with IPv6 2018-08-20 11:02:16 +02:00
khorben 68cacee9f1 Remove support for IPv6 for rules shared with IPv4 2018-08-20 11:02:16 +02:00
khorben 282aa2dc09 Provide enough space to resolve IPv6 addresses 2018-08-20 11:02:16 +02:00
khorben ba4d095daa Fix a couple more uses of ctype(3) 2018-08-20 11:02:16 +02:00
khorben dd0597f7f8 Code cleanup 2018-08-20 11:02:16 +02:00
khorben fa664db600 Add preliminary support for IPv6 with iptables 2018-08-20 11:02:16 +02:00
khorben 576eb11191 Add IPv6 support to --fw-list{,all} 2018-08-20 11:02:16 +02:00
khorben 7f9d09e8d3 Initialize the configuration for ip6tables as well 2018-08-20 11:02:16 +02:00
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