Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jan 2018 21:23:54 +0300
From:      "Andrey V. Elsukov" <bu7cher@yandex.ru>
To:        "O. Hartmann" <ohartmann@walstatt.org>, freebsd-current <freebsd-current@freebsd.org>, freebsd-ipfw@freebsd.org
Subject:   Re: ipfw: manpage: semantics of "receive" and "xmit" interfaces
Message-ID:  <5e6811ff-70c6-ee74-bf04-1319e9002b29@yandex.ru>
In-Reply-To: <20180109102813.63c32899@freyja.zeit4.iv.bundesimmobilien.de>
References:  <20180109102813.63c32899@freyja.zeit4.iv.bundesimmobilien.de>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--PKz3ZsVTGQoxL8RmsJ1SZVgP3UGYDFUeT
Content-Type: multipart/mixed; boundary="B7DR8RluztSdH7yswzwe7UbEIGYyiAv1L";
 protected-headers="v1"
From: "Andrey V. Elsukov" <bu7cher@yandex.ru>
To: "O. Hartmann" <ohartmann@walstatt.org>,
 freebsd-current <freebsd-current@freebsd.org>, freebsd-ipfw@freebsd.org
Message-ID: <5e6811ff-70c6-ee74-bf04-1319e9002b29@yandex.ru>
Subject: Re: ipfw: manpage: semantics of "receive" and "xmit" interfaces
References: <20180109102813.63c32899@freyja.zeit4.iv.bundesimmobilien.de>
In-Reply-To: <20180109102813.63c32899@freyja.zeit4.iv.bundesimmobilien.de>

--B7DR8RluztSdH7yswzwe7UbEIGYyiAv1L
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 09.01.2018 12:28, O. Hartmann wrote:
> In section RULE OPTIONS, there is recv|xmit|via explained (a bit). Ther=
e is
> also an example:
>=20
> ipfw add deny ip from any to any out recv ed0 xmit ed1
>=20
> Can someone explain a bit more what the semantics of these is? I get es=
pecially
> confused by the subsequent blocks of text following the line I mentione=
d above.
> Since not everybody using FreeBSD is capable of studying the kernel sou=
rces, I
> have difficulties to put those statements in line with a visualization =
of the
> packet flow. A local host receiving a packets destined for the local ho=
st can
> not have xmit interface? If I imagine, that the recv interface might be=
 the
> interface adjacent directly to the in/out port depicted in section PACK=
ET FLOW
> it doesn't give me any idea why there is no xmit interface.=20

When your system has two interfaces ed0 and ed1, and it acts as router,
a forwarded packet can be checked by firewall two times:

1. When a packet is received on ed0 interface, mbuf associated with this
packet gets a property "receiving interface". This packet is checked for
inbound direction and can be matched by "in" and "recv ed0" opcodes.
If it was not dropped by rules, it will go through IP stack and can be
forwarded according to routing table via interface ed1.

2. When the routing decision was made (i.e. outbound interface is
determined) a packet checked by firewall again, now for outbound
direction. And it can be matched by "out" and "xmit ed1" opcodes. The
opcode "recv ed0" still can be matched too, but "in" opcode will not
matched.

A packet destined for local host is consumed by local IP stack and will
not forwarded. It is checked by firewall only one time (usually). Thus
it can not have xmit interface.

--=20
WBR, Andrey V. Elsukov


--B7DR8RluztSdH7yswzwe7UbEIGYyiAv1L--

--PKz3ZsVTGQoxL8RmsJ1SZVgP3UGYDFUeT
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlpVCLoACgkQAcXqBBDI
oXrg7Af/UtYkLPPXrtOpqbvB4vuAUtHygXAujjmDUcfqtbFfxp2H4hEUotXJuPIk
xNp8Y8TQxb6bOWwwJiqJgvVAYPVT5ffob0Rb6iYZ0JDTL6qRGJ32vSorGaEF8kn+
MIV077lYAuTn+JUQE5Ecx8hw4UbBu820CvxY1hPhWsKCBfFpIgOsR59uKw1B5dmU
NmQ6leTGfKIOPO1rsjnSIpxm4lBCSwXThsTIZDVaxF1DeF9MzZUOnEgXDZw7EYSL
5xoF6oMZcRtZ7KXW8yCg52iPNMoJudi9BjP/d8gE5YB/9vsM6zeDv1CC3bjS317b
3v0WsYurElm5lQABSR7tuJ2qubDTAg==
=79yQ
-----END PGP SIGNATURE-----

--PKz3ZsVTGQoxL8RmsJ1SZVgP3UGYDFUeT--



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?5e6811ff-70c6-ee74-bf04-1319e9002b29>