Date: Sun, 30 Mar 2008 15:01:13 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 138984 for review Message-ID: <200803301501.m2UF1D3Z084148@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=138984 Change 138984 by piso@piso_newluxor on 2008/03/30 15:01:09 Fix a pointer dereference in LibAliasIn(), while here leave some debug around. Affected files ... .. //depot/projects/soc2005/libalias/sys/netinet/ip_fw_nat.c#4 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#74 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netinet/ip_fw_nat.c#4 (text+ko) ==== @@ -312,7 +312,8 @@ m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) ldt = 1; - + + printf("bef ip_len: %d ip_hl: %d\n", ntohs(ip->ip_len), ip->ip_hl); if (args->oif == NULL) retval = LibAliasIn(t->lib, &m, MCLBYTES); @@ -320,7 +321,7 @@ retval = LibAliasOut(t->lib, &m, MCLBYTES); if (retval != PKT_ALIAS_OK) { - printf("retval: "); + printf("retval: %d", retval); /* XXX - should i add some logging? */ m_free(m); badnat: ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#74 (text+ko) ==== @@ -282,6 +282,7 @@ IcmpAliasIn1(struct libalias *la, struct ip *pip, struct icmp *ic) { + printf("%s\n", __FUNCTION__); LIBALIAS_LOCK_ASSERT(la); /* De-alias incoming echo and timestamp replies. @@ -324,6 +325,7 @@ IcmpAliasIn2(struct libalias *la, pkt_t ptr) { + printf("%s\n", __FUNCTION__); LIBALIAS_LOCK_ASSERT(la); /* Alias incoming ICMP error messages containing @@ -430,6 +432,7 @@ struct ip *pip; struct icmp *ic; + printf("%s\n", __FUNCTION__); LIBALIAS_LOCK_ASSERT(la); /* Return if proxy-only mode is enabled */ if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY) @@ -1255,6 +1258,7 @@ struct ip *pip; int iresult; + printf("%s\n", __FUNCTION__); if (la->packetAliasMode & PKT_ALIAS_REVERSE) { la->packetAliasMode &= ~PKT_ALIAS_REVERSE; iresult = LibAliasOutLocked(la, ptr, maxpacketsize, 1); @@ -1264,26 +1268,32 @@ HouseKeeping(la); ClearCheckNewLink(la); PULLUP_IPHDR(pip, ptr); - pip = (struct ip *)ptr; alias_addr = pip->ip_dst; /* Defense against mangled packets */ if (ntohs(pip->ip_len) > maxpacketsize || (pip->ip_hl << 2) > maxpacketsize) { + printf("%d\n", __LINE__); + printf("maxpktsize: %d ip_len: %d ip_hl: %d\n", maxpacketsize, + ntohs(pip->ip_len), pip->ip_hl); iresult = PKT_ALIAS_IGNORED; goto getout; } iresult = PKT_ALIAS_IGNORED; if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0) { + printf("%d\n", __LINE__); switch (pip->ip_p) { case IPPROTO_ICMP: + printf("%d\n", __LINE__); iresult = IcmpAliasIn(la, ptr); break; case IPPROTO_UDP: + printf("%d\n", __LINE__); iresult = UdpAliasIn(la, ptr); break; case IPPROTO_TCP: + printf("%d\n", __LINE__); iresult = TcpAliasIn(la, ptr); break; case IPPROTO_GRE: { @@ -1308,6 +1318,7 @@ } break; default: + printf("%d\n", __LINE__); iresult = ProtoAliasIn(la, pip->ip_src, &pip->ip_dst, pip->ip_p, &pip->ip_sum); break; @@ -1325,6 +1336,7 @@ } } } else { + printf("%d\n", __LINE__); 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?200803301501.m2UF1D3Z084148>