Home | History | Annotate | Download | only in net
History log of /src/sys/dist/pf/net/if_pfsync.c
RevisionDateAuthorComments
 1.23  05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.22  10-Mar-2021  christos remove htons, it is pointless (thanks joerg@)
 1.21  10-Mar-2021  christos remove args from ip_randomid() (John D. Baker). When does this file get built?
 1.20  29-Jan-2020  thorpej branches: 1.20.6;
Adopt <net/if_stats.h>.
 1.19  22-Dec-2018  maxv branches: 1.19.6;
Replace M_ALIGN and MH_ALIGN by m_align.
 1.18  14-Sep-2018  maxv Use non-variadic function pointer in protosw::pr_input.
 1.17  27-Jun-2018  msaitoh branches: 1.17.2;
Add missing BPF_D_OUT. Reported by John D. Baker.
 1.16  26-Jun-2018  msaitoh Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.15  21-Jun-2016  ozaki-r branches: 1.15.16;
Replace ifp of ip_moptions and ip6_moptions with if_index

The motivation is the same as the mbuf's rcvif case; avoid having a pointer
of an ifnet object in ip_moptions and ip6_moptions, which is not MP-safe.

ip_moptions and ip6_moptions can be stored in a PCB for inet or inet6
that's life time is different from ifnet one and so an ifnet object can be
disappeared anytime we get it via them. Thus we need to look up an ifnet
object by if_index every time for safe.
 1.14  10-Jun-2016  ozaki-r Avoid storing a pointer of an interface in a mbuf

Having a pointer of an interface in a mbuf isn't safe if we remove big
kernel locks; an interface object (ifnet) can be destroyed anytime in any
packet processing and accessing such object via a pointer is racy. Instead
we have to get an object from the interface collection (ifindex2ifnet) via
an interface index (if_index) that is stored to a mbuf instead of an
pointer.

The change provides two APIs: m_{get,put}_rcvif_psref that use psref(9)
for sleep-able critical sections and m_{get,put}_rcvif that use
pserialize(9) for other critical sections. The change also adds another
API called m_get_rcvif_NOMPSAFE, that is NOT MP-safe and for transition
moratorium, i.e., it is intended to be used for places where are not
planned to be MP-ified soon.

The change adds some overhead due to psref to performance sensitive paths,
however the overhead is not serious, 2% down at worst.

Proposed on tech-kern and tech-net.
 1.13  10-Jun-2016  ozaki-r Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.12  28-Apr-2016  ozaki-r Constify rtentry of if_output

We no longer need to change rtentry below if_output.

The change makes it clear where rtentries are changed (or not)
and helps forthcoming locking (os psrefing) rtentries.
 1.11  20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.10  06-Mar-2014  nonaka branches: 1.10.6;
remove unused variable to avoid warning from gcc 4.8.
 1.9  22-Mar-2012  drochner branches: 1.9.2; 1.9.4;
remove KAME IPSEC, replaced by FAST_IPSEC
 1.8  19-Dec-2011  drochner do missing ipsec->kame_ipsec renames
 1.7  05-Nov-2010  rmind branches: 1.7.8; 1.7.12;
ip_randomid: make mechanism MP-safe and more modular.

OK matt@
 1.6  05-Apr-2010  joerg Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.5  23-Jan-2010  minskim branches: 1.5.2; 1.5.4;
Fix a typo introduced by the bpf linkage change.
 1.4  19-Jan-2010  pooka Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.3  14-Sep-2009  degroote Import pfsync support from OpenBSD 4.2

Pfsync interface exposes change in the pf(4) over a pseudo-interface, and can
be used to synchronise different pf.

This work was part of my 2009 GSoC

No objection on tech-net@
 1.2  22-Jun-2004  itojun branches: 1.2.58;
PF from openbsd 3.5. missing features:
- pfsync (due to protocol # assignment issues)
- carp (not really a PF portion, but thought important to mention)
- PF and ALTQ are mutually-exclusive. this will be sorted out when
kjc@csl.sony.co.jp updates ALTQ and PF (and API inbetween)

reviewed by matt, christos, perry

torture-test is very welcomed.
 1.1  22-Jun-2004  itojun branches: 1.1.1;
Initial revision
 1.1.1.4  01-Dec-2009  martti Import PF from OpenBSD 4.2
 1.1.1.3  01-Jul-2005  peter Import pf from OpenBSD 3.7 (kernel part).
 1.1.1.2  14-Nov-2004  yamt import pf from OpenBSD 3.6. (kernel part)
 1.1.1.1  22-Jun-2004  itojun PF from OpenBSD 3.5
 1.2.58.3  11-Aug-2010  yamt sync with head.
 1.2.58.2  11-Mar-2010  yamt sync with head
 1.2.58.1  16-Sep-2009  yamt sync with head
 1.5.4.2  05-Mar-2011  rmind sync with head
 1.5.4.1  30-May-2010  rmind sync with head
 1.5.2.2  06-Nov-2010  uebayasi Sync with HEAD.
 1.5.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.7.12.2  05-Apr-2012  mrg sync to latest -current.
 1.7.12.1  18-Feb-2012  mrg merge to -current.
 1.7.8.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.8.1  17-Apr-2012  yamt sync with head
 1.9.4.1  18-May-2014  rmind sync with head
 1.9.2.2  03-Dec-2017  jdolecek update from HEAD
 1.9.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.6.3  09-Jul-2016  skrll Sync with HEAD
 1.10.6.2  29-May-2016  skrll Sync with HEAD
 1.10.6.1  22-Sep-2015  skrll Sync with HEAD
 1.15.16.3  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.15.16.2  30-Sep-2018  pgoyette Ssync with HEAD
 1.15.16.1  28-Jul-2018  pgoyette Sync with HEAD
 1.17.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.17.2.1  10-Jun-2019  christos Sync with HEAD
 1.19.6.1  29-Feb-2020  ad Sync with head.
 1.20.6.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed