Date: Tue, 30 Jan 2007 15:03:19 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113705 for review Message-ID: <200701301503.l0UF3JMC015540@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113705 Change 113705 by piso@piso_newluxor on 2007/01/30 15:02:47 Start the mbuf-ication of libalias from IcmpAliasIn(): instead of passing a "struct ip *", pass down a "void *" that will be converted into a "struct ip *" in case libalias run in userland, or as "struct mbuf *" in case libalias run in kernel land. Propagate the "void *" down to all the IcmpAliasIn*() called by IcmpAliasIn(). Affected files ... .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#40 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#40 (text+ko) ==== @@ -256,9 +256,9 @@ /* Local prototypes */ -static int IcmpAliasIn1(struct libalias *, struct ip *); -static int IcmpAliasIn2(struct libalias *, struct ip *); -static int IcmpAliasIn(struct libalias *, struct ip *); +static int IcmpAliasIn1(struct libalias *, void *); +static int IcmpAliasIn2(struct libalias *, void *); +static int IcmpAliasIn(struct libalias *, void *); static int IcmpAliasOut1(struct libalias *, struct ip *, int create); static int IcmpAliasOut2(struct libalias *, struct ip *); @@ -275,16 +275,22 @@ static int -IcmpAliasIn1(struct libalias *la, struct ip *pip) +IcmpAliasIn1(struct libalias *la, void *ptr) { - + struct alias_link *lnk; + struct ip *pip; + struct icmp *ic; +#ifdef _KERNEL + // XXX - m_pullup() + pip = ptr; +#else + pip = ptr; +#endif LIBALIAS_LOCK_ASSERT(la); /* De-alias incoming echo and timestamp replies. Alias incoming echo and timestamp requests. */ - struct alias_link *lnk; - struct icmp *ic; ic = (struct icmp *)ip_next(pip); @@ -320,20 +326,26 @@ } static int -IcmpAliasIn2(struct libalias *la, struct ip *pip) +IcmpAliasIn2(struct libalias *la, void *ptr) { - - LIBALIAS_LOCK_ASSERT(la); /* Alias incoming ICMP error messages containing IP header and first 64 bits of datagram. */ - struct ip *ip; + struct ip *ip, *pip; struct icmp *ic, *ic2; struct udphdr *ud; struct tcphdr *tc; struct alias_link *lnk; +#ifdef _KERNEL + // XXX - m_pullup() + pip = ptr; +#else + pip = ptr; +#endif + + LIBALIAS_LOCK_ASSERT(la); ic = (struct icmp *)ip_next(pip); ip = &ic->icmp_ip; @@ -422,11 +434,18 @@ static int -IcmpAliasIn(struct libalias *la, struct ip *pip) +IcmpAliasIn(struct libalias *la, void *ptr) { int iresult; + struct ip *pip; struct icmp *ic; - +#ifdef _KERNEL + // XXX - m_pullup() + pip = ptr; +#else + pip = ptr; +#endif + LIBALIAS_LOCK_ASSERT(la); /* Return if proxy-only mode is enabled */ if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY) @@ -439,18 +458,18 @@ case ICMP_ECHOREPLY: case ICMP_TSTAMPREPLY: if (ic->icmp_code == 0) { - iresult = IcmpAliasIn1(la, pip); + iresult = IcmpAliasIn1(la, ptr); } break; case ICMP_UNREACH: case ICMP_SOURCEQUENCH: case ICMP_TIMXCEED: case ICMP_PARAMPROB: - iresult = IcmpAliasIn2(la, pip); + iresult = IcmpAliasIn2(la, ptr); break; case ICMP_ECHO: case ICMP_TSTAMP: - iresult = IcmpAliasIn1(la, pip); + iresult = IcmpAliasIn1(la, ptr); break; } return (iresult);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701301503.l0UF3JMC015540>