From owner-p4-projects@FreeBSD.ORG Tue Jan 30 17:01:24 2007 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 C611716A406; Tue, 30 Jan 2007 17:01:23 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8844816A403 for ; Tue, 30 Jan 2007 17:01:23 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 78B3F13C4A6 for ; Tue, 30 Jan 2007 17:01:23 +0000 (UTC) (envelope-from piso@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 l0UH1Nx3096430 for ; Tue, 30 Jan 2007 17:01:23 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0UH1NCk096416 for perforce@freebsd.org; Tue, 30 Jan 2007 17:01:23 GMT (envelope-from piso@freebsd.org) Date: Tue, 30 Jan 2007 17:01:23 GMT Message-Id: <200701301701.l0UH1NCk096416@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to piso@freebsd.org using -f From: Paolo Pisati To: Perforce Change Reviews Cc: Subject: PERFORCE change 113712 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, 30 Jan 2007 17:01:24 -0000 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);