From owner-p4-projects@FreeBSD.ORG Tue Jan 30 15:03:20 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 2C5BF16A406; Tue, 30 Jan 2007 15:03:20 +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 005D716A404 for ; Tue, 30 Jan 2007 15:03:19 +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 E44AA13C478 for ; Tue, 30 Jan 2007 15:03:19 +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 l0UF3Jic015549 for ; Tue, 30 Jan 2007 15:03:19 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0UF3JMC015540 for perforce@freebsd.org; Tue, 30 Jan 2007 15:03:19 GMT (envelope-from piso@freebsd.org) Date: Tue, 30 Jan 2007 15:03:19 GMT Message-Id: <200701301503.l0UF3JMC015540@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 113705 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 15:03:20 -0000 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);