Date: Mon, 7 Apr 2008 20:06:54 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 139541 for review Message-ID: <200804072006.m37K6s3N081879@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=139541 Change 139541 by piso@piso_newluxor on 2008/04/07 20:06:31 -don't pass to Libalias pkts coming from layer2 -reassemble packet before passing it to libalias (much like ip_divert does) -refresh ip ptr after passing it down in LibAliasLockedIn() -some more debug around This make libalias work with mbuf, modules are not ready. Affected files ... .. //depot/projects/soc2005/libalias/sys/netinet/ip_fw_nat.c#7 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#75 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netinet/ip_fw_nat.c#7 (text+ko) ==== @@ -250,9 +250,8 @@ int ldt, retval; /* ipfw_nat works only at layer 3 */ - if (args->eh != NULL) { - // XXX get out - } + if (args->eh != NULL) + goto badnat; ldt = 0; retval = 0; @@ -260,11 +259,13 @@ NULL) goto badnat; ip = mtod(m, struct ip *); + printf("%s()::%d - ip->ip_off: %d\n", __FUNCTION__, __LINE__, ip->ip_off); if (ip->ip_off & (IP_MF | IP_OFFMASK)) { - struct mbuf *reass = NULL; + struct mbuf *reass; + printf("fragment found\n"); /* Reassemble packet. */ - //reass = ip_reass(m); + reass = ip_reass(m); /* * IP header checksum fixup after reassembly and leave header @@ -284,7 +285,7 @@ ip->ip_sum = in_cksum(reass, hlen); m = reass; } else { - printf("fragment found\n"); + printf("can't reass\n"); m = NULL; goto badnat; } ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#75 (text+ko) ==== @@ -1282,7 +1282,7 @@ iresult = PKT_ALIAS_IGNORED; if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0) { - printf("%d\n", __LINE__); + printf("%s()::%d - ip->ip_off: %d\n", __FUNCTION__, __LINE__, pip->ip_off); switch (pip->ip_p) { case IPPROTO_ICMP: printf("%d\n", __LINE__); @@ -1324,9 +1324,11 @@ break; } + PULLUP_IPHDR(pip, ptr); if (ntohs(pip->ip_off) & IP_MF) { struct alias_link *lnk; + printf("%s()::%d - ip->ip_off: %d\n", __FUNCTION__, __LINE__, pip->ip_off); lnk = FindFragmentIn1(la, pip->ip_src, alias_addr, pip->ip_id); if (lnk != NULL) { iresult = PKT_ALIAS_FOUND_HEADER_FRAGMENT; @@ -1336,7 +1338,7 @@ } } } else { - printf("%d\n", __LINE__); + printf("%s()::%d - ip->ip_off: %d\n", __FUNCTION__, __LINE__, pip->ip_off); iresult = FragmentIn(la, pip->ip_src, &pip->ip_dst, pip->ip_id, &pip->ip_sum); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804072006.m37K6s3N081879>