aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Samorukov <samm@os2.kiev.ua>2021-01-04 01:41:34 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-01-04 13:28:28 +0100
commit2b94c053d1c2a0db88dbc4e1e470ae17c616ed92 (patch)
tree2aded3b5f4218c1a7d165dfb23520181322d5176
parentca2dc96be81440985af36c0724150498729e12a9 (diff)
downloadbusybox-w32-2b94c053d1c2a0db88dbc4e1e470ae17c616ed92.tar.gz
busybox-w32-2b94c053d1c2a0db88dbc4e1e470ae17c616ed92.tar.bz2
busybox-w32-2b94c053d1c2a0db88dbc4e1e470ae17c616ed92.zip
Fix traceroute applet on the FreeBSD
This patch addressing 2 issues: 1. Replacing source/dest with uh_sport/uh_dport. It seems that uh_* members are defined on both Linux and BSD, so no #ifdef here 2. Use SOL_IPV6 instead of SOL_RAW on the FreeBSD to fix IPV6_CHECKSUM setsockopt Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/traceroute.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c
index bd63e4449..8f5cd0bf2 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -716,8 +716,8 @@ packet4_ok(int read_len, int seq)
716// Off: since we do not form the entire IP packet, 716// Off: since we do not form the entire IP packet,
717// but defer it to kernel, we can't set source port, 717// but defer it to kernel, we can't set source port,
718// and thus can't check it here in the reply 718// and thus can't check it here in the reply
719 /* && up->source == ident */ 719 /* && up->uh_sport == ident */
720 && up->dest == htons(port + seq) 720 && up->uh_dport == htons(port + seq)
721 ) { 721 ) {
722 return (type == ICMP_TIMXCEED ? -1 : code + 1); 722 return (type == ICMP_TIMXCEED ? -1 : code + 1);
723 } 723 }
@@ -985,8 +985,13 @@ traceroute_init(int op, char **argv)
985 snd = xsocket(AF_INET, SOCK_DGRAM, 0); 985 snd = xsocket(AF_INET, SOCK_DGRAM, 0);
986 } 986 }
987#if ENABLE_TRACEROUTE6 987#if ENABLE_TRACEROUTE6
988# if defined(__FreeBSD__)
989# define SOL_V6_OPTION SOL_IPV6
990# else
991# define SOL_V6_OPTION SOL_RAW
992# endif
988 else { 993 else {
989 if (setsockopt_int(rcvsock, SOL_RAW, IPV6_CHECKSUM, 2) != 0) 994 if (setsockopt_int(rcvsock, SOL_V6_OPTION, IPV6_CHECKSUM, 2) != 0)
990 bb_perror_msg_and_die("setsockopt(%s)", "IPV6_CHECKSUM"); 995 bb_perror_msg_and_die("setsockopt(%s)", "IPV6_CHECKSUM");
991 if (op & OPT_USE_ICMP) 996 if (op & OPT_USE_ICMP)
992 snd = xsocket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); 997 snd = xsocket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);