From 6a99f83175d7b5b5868fb82328d569672b8bb9a4 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 27 Sep 2004 12:56:30 +0000 Subject: 2004-09-27 Paul Jakma * ospf_dump.c: (ospf_ip_header_dump) Use HAVE_IP_HDRINCL_BSD_ORDER Apply to offset too. Print ip_cksum, lets not worry about possible 2.0.37 compile problems. * ospf_packet.c: (ospf_swap_iph_to{n,h}) Use HAVE_IP_HDRINCL_BSD_ORDER. (ospf_recv_packet) ditto. (ospf_write) Fixup iov argument to ospf_write_frags. --- ospfd/ospf_dump.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'ospfd/ospf_dump.c') diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 958baa40..248cfbbc 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -602,15 +602,18 @@ void ospf_ip_header_dump (struct stream *s) { u_int16_t length; + u_int16_t offset; struct ip *iph; iph = (struct ip *) STREAM_PNT (s); -#ifdef GNU_LINUX - length = ntohs (iph->ip_len); -#else /* GNU_LINUX */ +#ifdef HAVE_IP_HDRINCL_BSD_ORDER length = iph->ip_len; -#endif /* GNU_LINUX */ + offset = iph->ip_off; +#else /* !HAVE_IP_HDRINCL_BSD_ORDER */ + length = ntohs (iph->ip_len); + offset = ntohs (iph->ip_off); +#endif /* HAVE_IP_HDRINCL_BSD_ORDER */ /* IP Header dump. */ zlog_info ("ip_v %d", iph->ip_v); @@ -618,12 +621,10 @@ ospf_ip_header_dump (struct stream *s) zlog_info ("ip_tos %d", iph->ip_tos); zlog_info ("ip_len %d", length); zlog_info ("ip_id %u", (u_int32_t) iph->ip_id); - zlog_info ("ip_off %u", (u_int32_t) iph->ip_off); + zlog_info ("ip_off %u", (u_int32_t) offset); zlog_info ("ip_ttl %d", iph->ip_ttl); zlog_info ("ip_p %d", iph->ip_p); - /* There is a report that Linux 2.0.37 does not have ip_sum. But - I'm not sure. Temporary commented out by kunihiro. */ - /* zlog_info ("ip_sum 0x%x", (u_int32_t) ntohs (iph->ip_sum)); */ + zlog_info ("ip_sum 0x%x", (u_int32_t) ntohs (iph->ip_sum)); zlog_info ("ip_src %s", inet_ntoa (iph->ip_src)); zlog_info ("ip_dst %s", inet_ntoa (iph->ip_dst)); } -- cgit v1.2.1