Date: Fri, 11 Sep 1998 18:38:17 -0700 (PDT) From: Archie Cobbs <archie@whistle.com> To: luigi@labinfo.iet.unipi.it (Luigi Rizzo) Cc: net@FreeBSD.ORG Subject: Re: PULLUP_TO in ip_fw.c Message-ID: <199809120138.SAA29403@bubba.whistle.com> In-Reply-To: <199809111112.NAA19733@labinfo.iet.unipi.it> from Luigi Rizzo at "Sep 11, 98 01:12:46 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Luigi Rizzo writes: > Ok, i adapted the ipfw code to bridged and non-ip packets, but > there is one minor issue: the macro PULLUP_TO is defined as > > #define PULLUP_TO(len) do { \ > if ((*m)->m_len < (len) \ > && (*m = m_pullup(*m, (len))) == 0) { \ > goto bogusfrag; \ > } \ > *pip = ip = mtod(*m, struct ip *); \ > offset = (ip->ip_off & IP_OFFMASK); \ > } while (0) > > and as such it requires that the mbuf starts with the ip header > and always writes into *pip and ip. > > In my case, I might pass the firewall an mbuf which includes an > ethernet header, and i make sure that m_pullup needs not to be called. > So i'd like to change the macro to > > #define PULLUP_TO(len) do { \ > if ((*m)->m_len < (len) ) { \ > if (*m = m_pullup(*m, (len)) == 0) \ > goto bogusfrag; \ > *pip = ip = mtod(*m, struct ip *); \ > offset = (ip->ip_off & IP_OFFMASK); \ > } > } while (0) > > which btw saves a few writes to variables in case m_pullup is not called. Looks good to me... should have been like that from the start. If the compiler gives you new warnings about uninitialized variables then we need to take a closer look :-) -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809120138.SAA29403>