Lines 1-6
Link Here
|
1 |
--- util.c.orig 2016-10-07 14:32:44 UTC |
1 |
--- util.c.orig 2019-11-15 11:52:26 UTC |
2 |
+++ util.c |
2 |
+++ util.c |
3 |
@@ -285,7 +285,7 @@ static int GetInterfaceIndex( const char |
3 |
@@ -285,7 +285,7 @@ static int GetInterfaceIndex( const char *psz_name ) |
4 |
|
4 |
|
5 |
close( i_fd ); |
5 |
close( i_fd ); |
6 |
|
6 |
|
Lines 9-15
Link Here
|
9 |
return ifr.ifr_index; |
9 |
return ifr.ifr_index; |
10 |
#else |
10 |
#else |
11 |
return ifr.ifr_ifindex; |
11 |
return ifr.ifr_ifindex; |
12 |
@@ -451,7 +451,7 @@ static void RawFillHeaders(struct udpraw |
12 |
@@ -454,7 +454,7 @@ static void RawFillHeaders(struct udprawpkt *dgram, |
13 |
uint8_t ttl, uint8_t tos, uint16_t len) |
13 |
uint8_t ttl, uint8_t tos, uint16_t len) |
14 |
{ |
14 |
{ |
15 |
#ifndef __APPLE__ |
15 |
#ifndef __APPLE__ |
Lines 18-24
Link Here
|
18 |
struct ip *iph = &(dgram->iph); |
18 |
struct ip *iph = &(dgram->iph); |
19 |
#else |
19 |
#else |
20 |
struct iphdr *iph = &(dgram->iph); |
20 |
struct iphdr *iph = &(dgram->iph); |
21 |
@@ -468,7 +468,7 @@ static void RawFillHeaders(struct udpraw |
21 |
@@ -471,7 +471,7 @@ static void RawFillHeaders(struct udprawpkt *dgram, |
22 |
printf("Filling raw header (%p) (%s:%u -> %s:%u)\n", dgram, ipsrc_str, portsrc, ipdst_str, portdst); |
22 |
printf("Filling raw header (%p) (%s:%u -> %s:%u)\n", dgram, ipsrc_str, portsrc, ipdst_str, portdst); |
23 |
#endif |
23 |
#endif |
24 |
|
24 |
|
Lines 27-33
Link Here
|
27 |
// Fill ip header |
27 |
// Fill ip header |
28 |
iph->ip_hl = 5; // ip header with no specific option |
28 |
iph->ip_hl = 5; // ip header with no specific option |
29 |
iph->ip_v = 4; |
29 |
iph->ip_v = 4; |
30 |
@@ -710,7 +710,7 @@ int OpenSocket( const char *_psz_arg, in |
30 |
@@ -558,7 +558,7 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint1 |
|
|
31 |
in_addr_t i_raw_srcaddr = INADDR_ANY; |
32 |
int i_raw_srcport = 0; |
33 |
char *psz_ifname = NULL; |
34 |
-#ifdef __FreeBSD__ |
35 |
+#if defined(__FreeBSD__) || defined(__DragonFly__) |
36 |
int hincl = 1; |
37 |
#endif |
38 |
|
39 |
@@ -718,7 +718,7 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint1 |
31 |
i_raw_srcaddr, connect_addr.sin.sin_addr.s_addr, i_raw_srcport, |
40 |
i_raw_srcaddr, connect_addr.sin.sin_addr.s_addr, i_raw_srcport, |
32 |
ntohs(connect_addr.sin.sin_port), i_ttl, i_tos, 0); |
41 |
ntohs(connect_addr.sin.sin_port), i_ttl, i_tos, 0); |
33 |
i_fd = socket( AF_INET, SOCK_RAW, IPPROTO_RAW ); |
42 |
i_fd = socket( AF_INET, SOCK_RAW, IPPROTO_RAW ); |
Lines 36-42
Link Here
|
36 |
if ( setsockopt( i_fd, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)) == -1 ) |
45 |
if ( setsockopt( i_fd, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)) == -1 ) |
37 |
{ |
46 |
{ |
38 |
msg_Err( NULL, "unable to set socket (%s)", strerror(errno) ); |
47 |
msg_Err( NULL, "unable to set socket (%s)", strerror(errno) ); |
39 |
@@ -747,7 +747,7 @@ int OpenSocket( const char *_psz_arg, in |
48 |
@@ -755,7 +755,7 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint1 |
40 |
|
49 |
|
41 |
if ( bind_addr.ss.ss_family != AF_UNSPEC ) |
50 |
if ( bind_addr.ss.ss_family != AF_UNSPEC ) |
42 |
{ |
51 |
{ |
Lines 45-51
Link Here
|
45 |
if ( IN6_IS_ADDR_MULTICAST( &bind_addr.sin6.sin6_addr ) ) |
54 |
if ( IN6_IS_ADDR_MULTICAST( &bind_addr.sin6.sin6_addr ) ) |
46 |
{ |
55 |
{ |
47 |
struct ipv6_mreq imr; |
56 |
struct ipv6_mreq imr; |
48 |
@@ -827,7 +827,7 @@ normal_bind: |
57 |
@@ -838,7 +838,7 @@ normal_bind: |
49 |
} |
58 |
} |
50 |
else |
59 |
else |
51 |
#endif |
60 |
#endif |