From: Antonio Quartulli <antonio@open-mesh.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Using skb->mark outside netfilter (was: [PATCH 0/3] bridge: implement restricted forwarding policy)
Date: Mon, 6 May 2013 20:48:17 +0200 [thread overview]
Message-ID: <20130506184817.GA2729@open-mesh.com> (raw)
In-Reply-To: <1365442863-32394-1-git-send-email-antonio@open-mesh.com>
[-- Attachment #1: Type: text/plain, Size: 3528 bytes --]
Hello all,
On Mon, Apr 08, 2013 at 10:41:00 -0700, Antonio Quartulli wrote:
[...]
> The goal we want to achieve by adding this feature consists in selecting a
> subset of the interfaces available on all the hosts participating to the mesh
> network and to prevent packets from being forwarded from one of them to another.
>
> Looking again at the "very big switch" abstraction this would allow a mesh
> network administrator to define a sort of "not forwarding policy network wide"
> between some of the big switch's port.
>
I'm resurrecting this thread because after Jamal's suggestion I decided to
finally drop the idea of introducing such a net flag and focus on a different
approach.
The new idea is to use tc to mark packets arriving into the bridge
through a predefined port (chosen by the admin when setting up the tc rule) and
again use tc to drop packets having such mark when they are going out through
another predefined port.
Now to extend this mechanism network-wide (remember that the use case is a Layer2
mesh network set up with batman-adv) I'm going to introduce a mechanism in
batman-adv itself which is supposed to read and write the skb->mark field
so that the value contained when the packet is leaving one end can be restored
later on the other end of the intra-mesh communication (only if it matches a pre
configured one).
This would allow the remote node to perform the same filtering
operation as if the packet was locally generated.
Now my question is (I think David is the one who should probably decide here):
is batman-adv allowed to touch the mark field of the sk_buff structure? Or is it
reserved for netfilter purposes only?
In my opinion this field (which survives whatever path the skb follows) is the
best option for this task as it allows batman-adv to "communicate" with
tc and possibly netfilter itself (if in the future users would like to perform
more complicated operations).
To clarify the idea, here you have an ascii art representing a possible setup
and how the mark will be read and set:
Scenario:
=========
- Two mesh nodes configured the same way.
- Packets arriving via eth0 have to be marked with M.
- Packets marked with M should be dropped before going out through eth1.
+------+
------|bridge|----
| +------+ |
| | |
[M]skb | [M]skb
+------+ +------+ +------+ The skb is generated when arriving on eth0 and
| bat0 | | eth1 | | eth0 | is marked with the value M.
+------+ +------+ +------+ batman-adv (operating in bat0) recognises the
| pkt mark and spread the information in the mesh
+------+ (other than forwarding the packet to the mesh).
|wlan0 |
+------+
:bat{pkt}
___:_______
/ \
| MESH |
\___________/
:
:bat{pkt}
+------+ batman-adv on the receiving side knows that
|wlan0 | this skb has to be marked and so it writes M
+------+ into skb->mark.
|[]skb The skb is now marked and can be dropped as
+------+ +------+ +------+ instructed.
| bat0 | | eth1 | | eth0 |
+------+ +------+ +------+
[M]skb | |
| | |
| +------+ |
------|bridge|-----
+------+
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-05-06 18:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 17:41 [PATCH 0/3] bridge: implement restricted forwarding policy Antonio Quartulli
2013-04-08 17:41 ` [PATCH 1/3] if.h: add IFF_BRIDGE_RESTRICTED flag Antonio Quartulli
2013-04-08 18:58 ` Stephen Hemminger
2013-04-09 6:33 ` Antonio Quartulli
2013-04-09 7:56 ` Antonio Quartulli
2013-04-09 12:57 ` Jamal Hadi Salim
2013-04-09 13:51 ` Antonio Quartulli
2013-04-09 15:49 ` Jamal Hadi Salim
2013-04-10 16:54 ` Antonio Quartulli
2013-04-10 20:46 ` Stephen Hemminger
2013-04-11 10:56 ` Antonio Quartulli
2013-04-11 11:03 ` Jamal Hadi Salim
2013-04-08 17:41 ` [PATCH 2/3] sk_buff: add bridge_restricted flag Antonio Quartulli
2013-04-08 17:41 ` [PATCH 3/3] bridge: implement restricted port forwarding policy Antonio Quartulli
2013-05-06 18:48 ` Antonio Quartulli [this message]
2013-05-07 13:04 ` Using skb->mark outside netfilter Jamal Hadi Salim
2013-05-07 13:23 ` Antonio Quartulli
2013-05-07 13:30 ` Jamal Hadi Salim
2013-05-07 14:17 ` Antonio Quartulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130506184817.GA2729@open-mesh.com \
--to=antonio@open-mesh.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).