Date: Tue, 30 Jan 2007 17:01:23 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113712 for review Message-ID: <200701301701.l0UH1NCk096416@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113712 Change 113712 by piso@piso_newluxor on 2007/01/30 17:00:51 Switch second argument of IcmpAliasOut*(), UdpAliasOut() or ProtoAliasOut() from 'struct ip *' to 'void *' in case libalias run in kernel land. Affected files ... .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#43 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#43 (text+ko) ==== @@ -260,15 +260,15 @@ 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 *); -static int IcmpAliasOut(struct libalias *, struct ip *, int create); +static int IcmpAliasOut1(struct libalias *, void *, int create); +static int IcmpAliasOut2(struct libalias *, void *); +static int IcmpAliasOut(struct libalias *, void *, int create); static int ProtoAliasIn(struct libalias *, void *); -static int ProtoAliasOut(struct libalias *, struct ip *, int create); +static int ProtoAliasOut(struct libalias *, void *, int create); static int UdpAliasIn(struct libalias *, void *); -static int UdpAliasOut(struct libalias *, struct ip *, int create); +static int UdpAliasOut(struct libalias *, void *, int create); static int TcpAliasIn(struct libalias *, void *); static int TcpAliasOut(struct libalias *, struct ip *, int, int create); @@ -477,14 +477,21 @@ static int -IcmpAliasOut1(struct libalias *la, struct ip *pip, int create) +IcmpAliasOut1(struct libalias *la, void *ptr, int create) { /* Alias outgoing echo and timestamp requests. De-alias outgoing echo and timestamp replies. */ 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); ic = (struct icmp *)ip_next(pip); @@ -522,17 +529,23 @@ static int -IcmpAliasOut2(struct libalias *la, struct ip *pip) +IcmpAliasOut2(struct libalias *la, void *ptr) { /* Alias outgoing 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); @@ -623,10 +636,17 @@ static int -IcmpAliasOut(struct libalias *la, struct ip *pip, int create) +IcmpAliasOut(struct libalias *la, void *ptr, int create) { int iresult; struct icmp *ic; + struct ip *pip; +#ifdef _KERNEL + // XXX m_pullup() + pip = ptr; +#else + pip = ptr; +#endif LIBALIAS_LOCK_ASSERT(la); (void)create; @@ -642,18 +662,18 @@ case ICMP_ECHO: case ICMP_TSTAMP: if (ic->icmp_code == 0) { - iresult = IcmpAliasOut1(la, pip, create); + iresult = IcmpAliasOut1(la, ptr, create); } break; case ICMP_UNREACH: case ICMP_SOURCEQUENCH: case ICMP_TIMXCEED: case ICMP_PARAMPROB: - iresult = IcmpAliasOut2(la, pip); + iresult = IcmpAliasOut2(la, ptr); break; case ICMP_ECHOREPLY: case ICMP_TSTAMPREPLY: - iresult = IcmpAliasOut1(la, pip, create); + iresult = IcmpAliasOut1(la, ptr, create); } return (iresult); } @@ -701,7 +721,7 @@ static int -ProtoAliasOut(struct libalias *la, struct ip *pip, int create) +ProtoAliasOut(struct libalias *la, void *ptr, int create) { /* Handle outgoing IP packets. The @@ -709,6 +729,13 @@ the source IP address of the packet. */ struct alias_link *lnk; + struct ip *pip; +#ifdef _KERNEL + // XXX m_pullup() + pip = ptr; +#else + pip = ptr; +#endif LIBALIAS_LOCK_ASSERT(la); (void)create; @@ -807,11 +834,18 @@ } static int -UdpAliasOut(struct libalias *la, struct ip *pip, int create) +UdpAliasOut(struct libalias *la, void *ptr, int create) { + struct ip *pip; struct udphdr *ud; struct alias_link *lnk; int error; +#ifdef _KERNEL + // XXX m_pullup() + pip = ptr; +#else + pip = ptr; +#endif LIBALIAS_LOCK_ASSERT(la); /* Return if proxy-only mode is enabled */ @@ -1127,7 +1161,7 @@ /* Local prototypes */ static int FragmentIn(struct libalias *, void *); -static int FragmentOut(struct libalias *, struct ip *); +static int FragmentOut(struct libalias *, void *); static int @@ -1159,9 +1193,16 @@ static int -FragmentOut(struct libalias *la, struct ip *pip) +FragmentOut(struct libalias *la, void *ptr) { + struct ip *pip; struct in_addr alias_address; +#ifdef _KERNEL + // XXX m_pullup() + pip = ptr; +#else + pip = ptr; +#endif LIBALIAS_LOCK_ASSERT(la); alias_address = FindAliasAddress(la, pip->ip_src);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701301701.l0UH1NCk096416>