summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_fw.c
diff options
context:
space:
mode:
authoralex <alex@FreeBSD.org>1998-02-06 02:45:54 +0000
committeralex <alex@FreeBSD.org>1998-02-06 02:45:54 +0000
commit678cd6e7de9a873f8a294e4a0143e2bffa6e8893 (patch)
treeb2212dba08afc96cd9a7ae280f430676942d4e18 /sys/netinet/ip_fw.c
parent3dee08370051ac4e72fbdc8c64f3558ed832e8ba (diff)
downloadFreeBSD-src-678cd6e7de9a873f8a294e4a0143e2bffa6e8893.zip
FreeBSD-src-678cd6e7de9a873f8a294e4a0143e2bffa6e8893.tar.gz
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 <marcs@znep.com> Submitted by: Archie Cobbs <archie@whistle.com> w/fix from me
Diffstat (limited to 'sys/netinet/ip_fw.c')
-rw-r--r--sys/netinet/ip_fw.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c
index 6525e78..d556860 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);
OpenPOWER on IntegriCloud