From 6b33361187feeb8c9c257ec149b4f75238af6c48 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 11 Oct 2004 10:11:25 +0000 Subject: 2004-10-11 Paul Jakma * ospf_dump.c: (ospf_ip_header_dump) Assume header is in host order remove ntohs that should have dissappeared. Take struct ip as argument, caller has to know there's an IP header at start of stream anyway. * ospf_dump.h: update declaration of ospf_ip_header_dump. * ospf_packet.c: (ospf_write) correct call to sockopt_iphdrincl_swab_htosys which was munging the header. (ospf_recv_packet) ip_len is needed for old OpenBSD fixup. (ospf_read) sockopt_iphdrincl_swab_systoh ip header as soon as we have it. --- ospfd/ospf_dump.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'ospfd/ospf_dump.c') diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index e34f3f62..e3ca1a02 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -599,27 +599,20 @@ ospf_packet_ls_ack_dump (struct stream *s, u_int16_t length) stream_set_getp (s, sp); } +/* Expects header to be in host order */ void -ospf_ip_header_dump (struct stream *s) +ospf_ip_header_dump (struct ip *iph) { - u_int16_t length; - u_int16_t offset; - struct ip *iph; - - iph = (struct ip *) STREAM_PNT (s); - - sockopt_iphdrincl_swab_systoh (iph); - /* IP Header dump. */ zlog_info ("ip_v %d", iph->ip_v); zlog_info ("ip_hl %d", iph->ip_hl); zlog_info ("ip_tos %d", iph->ip_tos); - zlog_info ("ip_len %d", length); + zlog_info ("ip_len %d", iph->ip_len); zlog_info ("ip_id %u", (u_int32_t) iph->ip_id); - zlog_info ("ip_off %u", (u_int32_t) offset); + zlog_info ("ip_off %u", (u_int32_t) iph->ip_off); zlog_info ("ip_ttl %d", iph->ip_ttl); zlog_info ("ip_p %d", iph->ip_p); - zlog_info ("ip_sum 0x%x", (u_int32_t) ntohs (iph->ip_sum)); + zlog_info ("ip_sum 0x%x", (u_int32_t) 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