Index: libdnet-stripped/include/dnet/ip.h =================================================================== --- libdnet-stripped/include/dnet/ip.h.orig +++ libdnet-stripped/include/dnet/ip.h @@ -25,7 +25,9 @@ typedef uint32_t ip_addr_t; #ifndef __GNUC__ +#ifndef __attribute__ # define __attribute__(x) +#endif # pragma pack(1) #endif @@ -34,23 +36,23 @@ typedef uint32_t ip_addr_t; */ struct ip_hdr { #if DNET_BYTESEX == DNET_BIG_ENDIAN - uint8_t ip_v:4, /* version */ - ip_hl:4; /* header length (incl any options) */ + uint8_t dnet_ip_v:4, /* version */ + dnet_ip_hl:4; /* header length (incl any options) */ #elif DNET_BYTESEX == DNET_LIL_ENDIAN - uint8_t ip_hl:4, - ip_v:4; + uint8_t dnet_ip_hl:4, + dnet_ip_v:4; #else # error "need to include " #endif - uint8_t ip_tos; /* type of service */ - uint16_t ip_len; /* total length (incl header) */ - uint16_t ip_id; /* identification */ - uint16_t ip_off; /* fragment offset and flags */ - uint8_t ip_ttl; /* time to live */ - uint8_t ip_p; /* protocol */ - uint16_t ip_sum; /* checksum */ - ip_addr_t ip_src; /* source address */ - ip_addr_t ip_dst; /* destination address */ + uint8_t dnet_ip_tos; /* type of service */ + uint16_t dnet_ip_len; /* total length (incl header) */ + uint16_t dnet_ip_id; /* identification */ + uint16_t dnet_ip_off; /* fragment offset and flags */ + uint8_t dnet_ip_ttl; /* time to live */ + uint8_t dnet_ip_p; /* protocol */ + uint16_t dnet_ip_sum; /* checksum */ + ip_addr_t dnet_ip_src; /* source address */ + ip_addr_t dnet_ip_dst; /* destination address */ }; /* Index: libdnet-stripped/include/dnet/tcp.h =================================================================== --- libdnet-stripped/include/dnet/tcp.h.orig +++ libdnet-stripped/include/dnet/tcp.h @@ -17,7 +17,9 @@ #define TCP_HDR_LEN_MAX (TCP_HDR_LEN + TCP_OPT_LEN_MAX) #ifndef __GNUC__ +#ifndef __attribute__ # define __attribute__(x) +#endif # pragma pack(1) #endif @@ -30,16 +32,16 @@ struct tcp_hdr { uint32_t th_seq; /* sequence number */ uint32_t th_ack; /* acknowledgment number */ #if DNET_BYTESEX == DNET_BIG_ENDIAN - uint8_t th_off:4, /* data offset */ - th_x2:4; /* (unused) */ + uint8_t dnet_th_off:4, /* data offset */ + dnet_th_x2:4; /* (unused) */ #elif DNET_BYTESEX == DNET_LIL_ENDIAN - uint8_t th_x2:4, - th_off:4; + uint8_t dnet_th_x2:4, + dnet_th_off:4; #else # error "need to include " #endif - uint8_t th_flags; /* control flags */ - uint16_t th_win; /* window */ + uint8_t dnet_th_flags; /* control flags */ + uint16_t dnet_th_win; /* window */ uint16_t th_sum; /* checksum */ uint16_t th_urp; /* urgent pointer */ }; Index: libdnet-stripped/include/dnet/icmp.h =================================================================== --- libdnet-stripped/include/dnet/icmp.h.orig +++ libdnet-stripped/include/dnet/icmp.h @@ -11,12 +11,13 @@ #ifndef DNET_ICMP_H #define DNET_ICMP_H - #define ICMP_HDR_LEN 4 /* base ICMP header length */ #define ICMP_LEN_MIN 8 /* minimum ICMP message size, with header */ #ifndef __GNUC__ +#ifndef __attribute__ # define __attribute__(x) +#endif # pragma pack(1) #endif @@ -95,14 +96,6 @@ struct icmp_hdr { #define ICMP_PHOTURIS_NEED_AUTHN 4 /* no authentication */ #define ICMP_PHOTURIS_NEED_AUTHZ 5 /* no authorization */ #define ICMP_TYPE_MAX 40 - -#define ICMP_INFOTYPE(type) \ - ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ - (type) == ICMP_RTRADVERT || (type) == ICMP_RTRSOLICIT || \ - (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ - (type) == ICMP_INFO || (type) == ICMP_INFOREPLY || \ - (type) == ICMP_MASK || (type) == ICMP_MASKREPLY) - /* * Echo message data */ @@ -127,8 +120,6 @@ struct icmp_msg_needfrag { */ struct icmp_msg_quote { uint32_t icmp_void; /* must be zero */ -#define icmp_gwaddr icmp_void /* router IP address to use */ -#define icmp_pptr icmp_void /* ptr to bad octet field */ uint8_t icmp_ip __flexarr; /* IP hdr + 8 bytes of pkt */ }; @@ -141,7 +132,6 @@ struct icmp_msg_rtradvert { uint16_t icmp_lifetime; /* route lifetime in seconds */ struct icmp_msg_rtr_data { uint32_t icmp_void; -#define icmp_gwaddr icmp_void /* router IP address */ uint32_t icmp_pref; /* router preference (usu 0) */ } icmp_rtr __flexarr; /* variable # of routers */ }; Index: libdnet-stripped/src/arp-ioctl.c =================================================================== --- libdnet-stripped/src/arp-ioctl.c.orig +++ libdnet-stripped/src/arp-ioctl.c @@ -383,7 +383,7 @@ arp_loop(arp_t *r, arp_handler callback, } return (ret); } -#elif defined(HAVE_NET_RADIX_H) +#elif defined(HAVE_NET_RADIX_H) && ! defined(_AIX) /* XXX - Tru64, others? */ #include #include Index: libdnet-stripped/src/intf.c =================================================================== --- libdnet-stripped/src/intf.c.orig +++ libdnet-stripped/src/intf.c @@ -284,7 +283,9 @@ intf_set(intf_t *intf, const struct intf /* Set interface MTU. */ if (entry->intf_mtu != 0) { ifr.ifr_mtu = entry->intf_mtu; +#ifdef SIOCSIFMTU if (ioctl(intf->fd, SIOCSIFMTU, &ifr) < 0) +#endif return (-1); } /* Set interface address. */ @@ -396,7 +395,9 @@ _intf_get_noalias(intf_t *intf, struct i _intf_set_type(entry); /* Get interface MTU. */ +#ifdef SIOCGIFMTU if (ioctl(intf->fd, SIOCGIFMTU, &ifr) < 0) +#endif return (-1); entry->intf_mtu = ifr.ifr_mtu; Index: libdnet-stripped/src/ip-cooked.c =================================================================== --- libdnet-stripped/src/ip-cooked.c.orig +++ libdnet-stripped/src/ip-cooked.c @@ -153,13 +153,13 @@ ip_send(ip_t *ip, const void *buf, size_ iph = (struct ip_hdr *)buf; - if ((ipi = _lookup_ip_intf(ip, iph->ip_dst)) == NULL) { + if ((ipi = _lookup_ip_intf(ip, iph->dnet_ip_dst)) == NULL) { errno = EHOSTUNREACH; return (-1); } arpent.arp_pa.addr_type = ADDR_TYPE_IP; arpent.arp_pa.addr_bits = IP_ADDR_BITS; - arpent.arp_pa.addr_ip = iph->ip_dst; + arpent.arp_pa.addr_ip = iph->dnet_ip_dst; memcpy(&rtent.route_dst, &arpent.arp_pa, sizeof(rtent.route_dst)); for (i = 0, usec = 10; i < 3; i++, usec *= 100) { @@ -187,7 +187,7 @@ ip_send(ip_t *ip, const void *buf, size_ u_char *p, *start, *end, *ip_data; int ip_hl, fraglen; - ip_hl = iph->ip_hl << 2; + ip_hl = iph->dnet_ip_hl << 2; fraglen = ipi->mtu - ip_hl; iph = (struct ip_hdr *)(frame + ETH_HDR_LEN); @@ -200,8 +200,8 @@ ip_send(ip_t *ip, const void *buf, size_ for (p = start; p < end; ) { memcpy(ip_data, p, fraglen); - iph->ip_len = htons(ip_hl + fraglen); - iph->ip_off = htons(((p + fraglen < end) ? IP_MF : 0) | + iph->dnet_ip_len = htons(ip_hl + fraglen); + iph->dnet_ip_off = htons(((p + fraglen < end) ? IP_MF : 0) | ((p - start) >> 3)); ip_checksum(iph, ip_hl + fraglen); Index: libdnet-stripped/src/ip-util.c =================================================================== --- libdnet-stripped/src/ip-util.c.orig +++ libdnet-stripped/src/ip-util.c @@ -32,15 +32,15 @@ ip_add_option(void *buf, size_t len, int return (-1); } ip = (struct ip_hdr *)buf; - hl = ip->ip_hl << 2; + hl = ip->dnet_ip_hl << 2; p = (u_char *)buf + hl; if (proto == IP_PROTO_TCP) { tcp = (struct tcp_hdr *)p; - hl = tcp->th_off << 2; + hl = tcp->dnet_th_off << 2; p = (u_char *)tcp + hl; } - datalen = ntohs(ip->ip_len) - (int) (p - (u_char *)buf); + datalen = ntohs(ip->dnet_ip_len) - (int) (p - (u_char *)buf); /* Compute padding to next word boundary. */ if ((padlen = (int) (4 - (optlen % 4))) == 4) @@ -48,7 +48,7 @@ ip_add_option(void *buf, size_t len, int /* XXX - IP_HDR_LEN_MAX == TCP_HDR_LEN_MAX */ if (hl + optlen + padlen > IP_HDR_LEN_MAX || - ntohs(ip->ip_len) + optlen + padlen > len) { + ntohs(ip->dnet_ip_len) + optlen + padlen > len) { errno = EINVAL; return (-1); } @@ -70,11 +70,11 @@ ip_add_option(void *buf, size_t len, int optlen += padlen; if (proto == IP_PROTO_IP) - ip->ip_hl = (uint8_t) (p - (u_char *)ip) >> 2; + ip->dnet_ip_hl = (uint8_t) (p - (u_char *)ip) >> 2; else if (proto == IP_PROTO_TCP) - tcp->th_off = (uint8_t) (p - (u_char *)tcp) >> 2; + tcp->dnet_th_off = (uint8_t) (p - (u_char *)tcp) >> 2; - ip->ip_len = htons(ntohs(ip->ip_len) + (unsigned short) optlen); + ip->dnet_ip_len = htons(ntohs(ip->dnet_ip_len) + (unsigned short) optlen); return ((ssize_t) optlen); } @@ -89,41 +89,41 @@ ip_checksum(void *buf, size_t len) return; ip = (struct ip_hdr *)buf; - hl = ip->ip_hl << 2; - ip->ip_sum = 0; + hl = ip->dnet_ip_hl << 2; + ip->dnet_ip_sum = 0; sum = ip_cksum_add(ip, hl, 0); - ip->ip_sum = ip_cksum_carry(sum); + ip->dnet_ip_sum = ip_cksum_carry(sum); - off = htons(ip->ip_off); + off = htons(ip->dnet_ip_off); if ((off & IP_OFFMASK) != 0 || (off & IP_MF) != 0) return; len -= hl; - if (ip->ip_p == IP_PROTO_TCP) { + if (ip->dnet_ip_p == IP_PROTO_TCP) { struct tcp_hdr *tcp = (struct tcp_hdr *)((u_char *)ip + hl); if (len >= TCP_HDR_LEN) { tcp->th_sum = 0; sum = ip_cksum_add(tcp, len, 0) + - htons(ip->ip_p + (unsigned short) len); - sum = ip_cksum_add(&ip->ip_src, 8, sum); + htons(ip->dnet_ip_p + (unsigned short) len); + sum = ip_cksum_add(&ip->dnet_ip_src, 8, sum); tcp->th_sum = ip_cksum_carry(sum); } - } else if (ip->ip_p == IP_PROTO_UDP) { + } else if (ip->dnet_ip_p == IP_PROTO_UDP) { struct udp_hdr *udp = (struct udp_hdr *)((u_char *)ip + hl); if (len >= UDP_HDR_LEN) { udp->uh_sum = 0; sum = ip_cksum_add(udp, len, 0) + - htons(ip->ip_p + (unsigned short) len); - sum = ip_cksum_add(&ip->ip_src, 8, sum); + htons(ip->dnet_ip_p + (unsigned short) len); + sum = ip_cksum_add(&ip->dnet_ip_src, 8, sum); udp->uh_sum = ip_cksum_carry(sum); if (!udp->uh_sum) udp->uh_sum = 0xffff; /* RFC 768 */ } - } else if (ip->ip_p == IP_PROTO_ICMP || ip->ip_p == IP_PROTO_IGMP) { + } else if (ip->dnet_ip_p == IP_PROTO_ICMP || ip->dnet_ip_p == IP_PROTO_IGMP) { struct icmp_hdr *icmp = (struct icmp_hdr *)((u_char *)ip + hl); if (len >= ICMP_HDR_LEN) { Index: libdnet-stripped/src/ip.c =================================================================== --- libdnet-stripped/src/ip.c.orig +++ libdnet-stripped/src/ip.c @@ -72,17 +72,17 @@ ip_send(ip_t *i, const void *buf, size_t sin.sin_len = sizeof(sin); #endif sin.sin_family = AF_INET; - sin.sin_addr.s_addr = ip->ip_dst; + sin.sin_addr.s_addr = ip->dnet_ip_dst; #ifdef HAVE_RAWIP_HOST_OFFLEN - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); + ip->dnet_ip_len = ntohs(ip->dnet_ip_len); + ip->dnet_ip_off = ntohs(ip->dnet_ip_off); len = sendto(i->fd, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)); - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); + ip->dnet_ip_len = htons(ip->dnet_ip_len); + ip->dnet_ip_off = htons(ip->dnet_ip_off); return (len); #else Index: libdnet-stripped/src/route-bsd.c =================================================================== --- libdnet-stripped/src/route-bsd.c.orig +++ libdnet-stripped/src/route-bsd.c @@ -407,7 +407,7 @@ route_loop(route_t *r, route_handler cal } return (0); } -#elif defined(HAVE_NET_RADIX_H) +#elif defined(HAVE_NET_RADIX_H) && ! defined(_AIX) /* XXX - Tru64, others? */ #include Index: nmapfe/nmapfe_sig.c =================================================================== --- nmapfe/nmapfe_sig.c.orig +++ nmapfe/nmapfe_sig.c @@ -230,9 +230,10 @@ saveLog (char *filename) if (filename && *filename) { FILE *file; if ((file = fopen(filename, "w"))) { + gchar *text; gtk_text_buffer_get_start_iter(opt.buffer, &start); gtk_text_buffer_get_end_iter(opt.buffer, &end); - gchar *text = gtk_text_buffer_get_text(opt.buffer, + text = gtk_text_buffer_get_text(opt.buffer, &start, &end, FALSE); fputs(text, file); @@ -267,7 +268,7 @@ void openLog(char *filename) void okButton_clicked_cb(GtkWidget *window, GtkButton *button) { const char *selected = gtk_file_selection_get_filename(GTK_FILE_SELECTION(window)); -void (*action)() = g_object_get_data(G_OBJECT(window), "NmapFE_action"); +void (*action)() = (void (*)())g_object_get_data(G_OBJECT(window), "NmapFE_action"); GtkEntry *entry = g_object_get_data(G_OBJECT(window), "NmapFE_entry"); char *filename = g_object_get_data(G_OBJECT(window), "NmapFE_filename"); Index: libdnet-stripped/include/dnet/arp.h =================================================================== --- libdnet-stripped/include/dnet/arp.h.orig +++ libdnet-stripped/include/dnet/arp.h @@ -16,7 +16,9 @@ #define ARP_ETHIP_LEN 20 /* base ARP message length */ #ifndef __GNUC__ +#ifndef __attribute__ # define __attribute__(x) +#endif # pragma pack(1) #endif Index: libdnet-stripped/include/dnet/ip6.h =================================================================== --- libdnet-stripped/include/dnet/ip6.h.orig +++ libdnet-stripped/include/dnet/ip6.h @@ -25,7 +25,9 @@ typedef struct ip6_addr { } ip6_addr_t; #ifndef __GNUC__ +#ifndef __attribute__ # define __attribute__(x) +#endif # pragma pack(1) #endif