Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Sep 1998 13:12:46 +0200 (MET DST)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        net@FreeBSD.ORG
Subject:   PULLUP_TO in ip_fw.c
Message-ID:  <199809111112.NAA19733@labinfo.iet.unipi.it>

next in thread | raw e-mail | index | archive | help
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.

If there are no objections i am going to do this in the weekend (assuming
our router will be fixed by then :(

	luigi
-----------------------------+--------------------------------------
Luigi Rizzo                  |  Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it    |  Universita' di Pisa
tel: +39-50-568533           |  via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522           |  http://www.iet.unipi.it/~luigi/
_____________________________|______________________________________


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?199809111112.NAA19733>