From owner-p4-projects@FreeBSD.ORG Tue Jun 27 12:15:05 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8F8A116A406; Tue, 27 Jun 2006 12:15:05 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 64F0A16A400 for ; Tue, 27 Jun 2006 12:15:05 +0000 (UTC) (envelope-from clem1@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA1AE43D45 for ; Tue, 27 Jun 2006 12:15:00 +0000 (GMT) (envelope-from clem1@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5RCF0of028002 for ; Tue, 27 Jun 2006 12:15:00 GMT (envelope-from clem1@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5RCF0i1027991 for perforce@freebsd.org; Tue, 27 Jun 2006 12:15:00 GMT (envelope-from clem1@FreeBSD.org) Date: Tue, 27 Jun 2006 12:15:00 GMT Message-Id: <200606271215.k5RCF0i1027991@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to clem1@FreeBSD.org using -f From: Clément Lecigne To: Perforce Change Reviews Cc: Subject: PERFORCE change 100136 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jun 2006 12:15:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=100136 Change 100136 by clem1@clem1_ipv6vulns on 2006/06/27 12:14:08 libnet improvements around extension headers and checksum calculation. Affected files ... .. //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_build_ip.c#3 edit .. //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_internal.c#3 edit .. //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_link_bpf.c#2 edit .. //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_pblock.c#4 edit .. //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_write.c#2 edit Differences ... ==== //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_build_ip.c#3 (text+ko) ==== @@ -519,6 +519,8 @@ } } + libnet_pblock_record_ip_offset(l, l->total_size); + /* no checksum for IPv6 */ return (ptag ? ptag : libnet_pblock_update(l, p, LIBNET_IPV6_H, LIBNET_PBLOCK_IPV6_H)); @@ -599,6 +601,8 @@ } } + libnet_pblock_record_ip_offset(l, l->total_size); + /* * Update the protocol block's meta information and return the protocol * tag id of this pblock. This tag will be used to locate the pblock @@ -686,6 +690,8 @@ } } + libnet_pblock_record_ip_offset(l, l->total_size); + /* * Update the protocol block's meta information and return the protocol * tag id of this pblock. This tag will be used to locate the pblock @@ -770,6 +776,8 @@ } } + libnet_pblock_record_ip_offset(l, l->total_size); + /* * Update the protocol block's meta information and return the protocol * tag id of this pblock. This tag will be used to locate the pblock @@ -854,6 +862,8 @@ } } + libnet_pblock_record_ip_offset(l, l->total_size); + /* * Update the protocol block's meta information and return the protocol * tag id of this pblock. This tag will be used to locate the pblock ==== //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_internal.c#3 (text+ko) ==== ==== //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_link_bpf.c#2 (text+ko) ==== ==== //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_pblock.c#4 (text+ko) ==== @@ -389,37 +389,8 @@ { if ((q->flags) & LIBNET_PBLOCK_DO_CHECKSUM) { - int offset; - if (l->injection_type != LIBNET_LINK) - { - offset = (l->total_size + l->aligner) - q->ip_offset; - } - else - { - offset = l->aligner; - switch(l->pblock_end->type){ - case LIBNET_PBLOCK_ETH_H: - offset += LIBNET_ETH_H; - break; - case LIBNET_PBLOCK_TOKEN_RING_H: - offset += LIBNET_TOKEN_RING_H; - break; - case LIBNET_PBLOCK_FDDI_H: - offset += LIBNET_FDDI_H; - break; - case LIBNET_PBLOCK_802_1Q_H: - offset += LIBNET_802_1Q_H; - break; - case LIBNET_PBLOCK_ISL_H: - offset += LIBNET_ISL_H; - break; - case LIBNET_PBLOCK_802_3_H: - offset += LIBNET_802_3_H; - break; - default: - break; - } - } + int offset = (l->total_size + l->aligner) - q->ip_offset; + c = libnet_do_checksum(l, *packet + offset, libnet_pblock_p2p(q->type), q->h_len); if (c == -1) @@ -546,9 +517,20 @@ do { - p->ip_offset = offset; + /* + * update ip offset only if it was not set before. + */ + if (p->ip_offset == 0) + { + p->ip_offset = offset; + } p = p->prev; - } while (p && p->type != LIBNET_PBLOCK_IPV4_H); + } while (p && (p->type != LIBNET_PBLOCK_IPV4_H || + p->type != LIBNET_PBLOCK_IPV6_H || + p->type != LIBNET_PBLOCK_IPV6_FRAG_H || + p->type != LIBNET_PBLOCK_IPV6_ROUTING_H || + p->type != LIBNET_PBLOCK_IPV6_DESTOPTS_H || + p->type != LIBNET_PBLOCK_IPV6_HBHOPTS_H)); } ==== //depot/projects/soc2006/clem1_ipv6vulns/libnet/src/libnet_write.c#2 (text+ko) ====