Permalink
Browse files

Define our own generic 'struct ip6_option' structure, as a workaround…

… for porting the tool to Mac OS
  • Loading branch information...
1 parent dcfa019 commit c1551a629241a0cf087dfd32667149d5f82a070a @fgont fgont committed Jul 21, 2012
Showing with 18 additions and 13 deletions.
  1. +4 −4 tools/scan6.c
  2. +14 −9 tools/scan6.h
View
@@ -1916,7 +1916,7 @@ int multi_scan_local(pcap_t *pfd, struct iface_data *idata, struct in6_addr *src
struct in6_addr targetaddr;
struct sigaction new_sig, old_sig;
struct ip6_dest *destopth;
- struct ip6_opt *opt;
+ struct ip6_option *opt;
u_int32_t *uint32;
unsigned char error_f=0, closefd_f=0, llocalsrc_f=0;
int result;
@@ -2059,7 +2059,7 @@ int multi_scan_local(pcap_t *pfd, struct iface_data *idata, struct in6_addr *src
destopth->ip6d_nxt= IPPROTO_ICMPV6;
ptr= ptr + 2;
- opt= (struct ip6_opt *) ptr;
+ opt= (struct ip6_option *) ptr;
opt->ip6o_type= 0x80;
opt->ip6o_len= 4;
@@ -2271,7 +2271,7 @@ int host_scan_local(pcap_t *pfd, struct iface_data *idata, struct in6_addr *srca
struct in6_addr targetaddr;
struct sigaction new_sig, old_sig;
struct ip6_dest *destopth;
- struct ip6_opt *opt;
+ struct ip6_option *opt;
u_int32_t *uint32;
unsigned char foundaddr_f=0, error_f=0, closefd_f=0;
int result;
@@ -2413,7 +2413,7 @@ int host_scan_local(pcap_t *pfd, struct iface_data *idata, struct in6_addr *srca
destopth->ip6d_nxt= IPPROTO_ICMPV6;
ptr= ptr + 2;
- opt= (struct ip6_opt *) ptr;
+ opt= (struct ip6_option *) ptr;
opt->ip6o_type= 0x80;
opt->ip6o_len= 4;
View
@@ -134,6 +134,20 @@ struct ether_header
} __attribute__ ((__packed__));
+/* IPv6 options
+
+ Most stacks define "struct ip_opt" for this purpose. But ias has proved to be painful to use this
+ structure in Mac OS, since its definition seems to depend on the Xcode version, which is hard
+ (if at all possible) to check at compile time. As a workaround, we define our own data type for
+ IPv6 options
+*/
+struct ip6_option{
+ uint8_t ip6o_type;
+ uint8_t ip6o_len;
+} __attribute__ ((__packed__));
+
+
+
struct host_entry{
struct in6_addr ip6;
struct ether_addr ether;
@@ -199,15 +213,6 @@ struct iface_data{
#endif
-#if defined(__APPLE__)
-/* IPv6 options */
-struct ip6_opt{
- uint8_t ip6o_type;
- uint8_t ip6o_len;
-} __attribute__ ((__packed__));
-#endif
-
-
/* This causes Linux to use the BSD definition of the TCP and UDP header fields */
#ifndef __FAVOR_BSD
#define __FAVOR_BSD

0 comments on commit c1551a6

Please sign in to comment.