From: jamal <hadi@cyberus.ca>
To: Herbert Xu <herbert@gondor.apana.org.au>,
Timo Teras <timo.teras@iki.fi>,
"David S. Miller" <davem@davemloft.net>,
Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org
Subject: [RFC] SPD basic actions per netdev
Date: Wed, 31 Mar 2010 12:37:58 -0400 [thread overview]
Message-ID: <1270053478.26743.111.camel@bigi> (raw)
This may be oversight in current implementation and possibly
nobody has needed it before - hence it is not functional.
I want to have a drop-all policy on a per-interface level
for incoming packets and add exceptions as i need them.
[using the flow table is cheap if you have xfrm built in].
i.e something along the lines of:
#eth0, wild-card drop all
ip xfrm policy add src 0.0.0.0/0 dst 0.0.0.0/0 dev eth0 \
dir in ptype main action block priority $SOME-HIGH-value
#eth0, exception
ip xfrm policy add blah blah dev eth0 \
dir in ptype main action allow priority $SOME-small-value
#eth1, wild-card drop all
ip xfrm policy add src 0.0.0.0/0 dst 0.0.0.0/0 dev eth1 \
dir in ptype main action block priority $SOME-HIGH-value
#eth1 exception ...
The problem is this works as long as i dont specify an interface.
i.e, this would work in the in-direction:
ip xfrm policy add src 0.0.0.0/0 dst 0.0.0.0/0 \
dir in ptype main action block priority $SOME-HIGH-value
This would not work:
ip xfrm policy add src 0.0.0.0/0 dst 0.0.0.0/0 dev eth0 \
dir in ptype main action block priority $SOME-HIGH-value
The checks in the selector matching is the culprit, example for v4:
__xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl)
{
return .... &&
.... &&
(fl->oif == sel->ifindex || !sel->ifindex);
}
i.e in the second case i have a non-zero sel->ifindex but
a zero fl->oif; so it wont match.
One approach to fix this is to pass the direction then i can do
in the function call, then i can do something along the lines of
matching if:
(fl_dir == FLOW_DIR_IN && (fl->iif == sel->ifindex || !sel->ifindex) ||
(fl->oif == sel->ifindex || !sel->ifindex);
Is there any reason the selector matching only assumes fl->oif?
Are there any unforeseen issues/breakages if i added a check for the
above.
cheers,
jamal
next reply other threads:[~2010-03-31 16:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-31 16:37 jamal [this message]
2010-03-31 22:58 ` [RFC] SPD basic actions per netdev jamal
2010-04-01 0:33 ` Herbert Xu
2010-04-01 2:35 ` jamal
2010-04-01 2:52 ` Herbert Xu
2010-04-01 4:52 ` Timo Teräs
2010-04-01 6:01 ` Herbert Xu
2010-04-01 6:20 ` Timo Teräs
2010-04-01 6:28 ` Herbert Xu
2010-04-01 6:32 ` Timo Teräs
2010-04-01 6:39 ` Herbert Xu
2010-04-01 11:29 ` jamal
2010-04-01 11:47 ` Timo Teräs
2010-04-01 12:00 ` jamal
2010-04-01 12:10 ` Timo Teräs
2010-04-01 12:34 ` jamal
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=1270053478.26743.111.camel@bigi \
--to=hadi@cyberus.ca \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=timo.teras@iki.fi \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.