From 922c1488705af1f0582223daa1c72fd467d3bf10 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 6 Feb 1998 02:45:54 +0000 Subject: [PATCH] Don't attempt to display information which we don't have: specifically, TCP and UDP port numbers in fragmented packets when IP offset != 0. 2.2.6 candidate. Discovered by: Marc Slemko Submitted by: Archie Cobbs w/fix from me --- sys/netinet/ip_fw.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c index 6525e78baed6..d55686026cd3 100644 --- a/sys/netinet/ip_fw.c +++ b/sys/netinet/ip_fw.c @@ -12,7 +12,7 @@ * * This software is provided ``AS IS'' without any warranties of any kind. * - * $Id: ip_fw.c,v 1.73 1998/01/08 23:41:52 eivind Exp $ + * $Id: ip_fw.c,v 1.74 1998/02/04 22:33:07 eivind Exp $ */ /* @@ -310,16 +310,24 @@ ipfw_report(struct ip_fw *f, struct ip *ip, case IPPROTO_TCP: printf("TCP "); print_ip(ip->ip_src); - printf(":%d ", ntohs(tcp->th_sport)); + if ((ip->ip_off & IP_OFFMASK) == 0) + printf(":%d ", ntohs(tcp->th_sport)); + else + printf(" "); print_ip(ip->ip_dst); - printf(":%d", ntohs(tcp->th_dport)); + if ((ip->ip_off & IP_OFFMASK) == 0) + printf(":%d", ntohs(tcp->th_dport)); break; case IPPROTO_UDP: printf("UDP "); print_ip(ip->ip_src); - printf(":%d ", ntohs(udp->uh_sport)); + if ((ip->ip_off & IP_OFFMASK) == 0) + printf(":%d ", ntohs(udp->uh_sport)); + else + printf(" "); print_ip(ip->ip_dst); - printf(":%d", ntohs(udp->uh_dport)); + if ((ip->ip_off & IP_OFFMASK) == 0) + printf(":%d", ntohs(udp->uh_dport)); break; case IPPROTO_ICMP: printf("ICMP:%u.%u ", icmp->icmp_type, icmp->icmp_code);