From: Kunihiro Ishiguro <kunihiro@ipinfusion.com>
To: "David S. Miller" <davem@redhat.com>
Cc: Kazunori.Miyazawa@jp.yokogawa.com, netdev@oss.sgi.com,
usagi-core@linux-ipv6.org, kuznet@ms2.inr.ac.ru
Subject: Re: [PATCH] IPv6 IPsec support
Date: Wed, 19 Feb 2003 01:13:51 -0800 [thread overview]
Message-ID: <87of58hbu8.wl@ipinfusion.com> (raw)
In-Reply-To: <20030218.230211.89243941.davem@redhat.com>
>I would ask that Alexey and myself stay on the CC: list.
>
>It would not hurt to keep netdev as well, perhaps we can
>breed some new experts in our ipsec code :-)
I believe many ipsec experts on this list ;-).
>@@ -428,20 +455,79 @@
> static inline int
> xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl)
> {
>- return !memcmp(fl->fl6_dst, sel->daddr.a6, sizeof(struct in6_addr)) &&
>- !((fl->uli_u.ports.dport^sel->dport)&sel->dport_mask) &&
>- !((fl->uli_u.ports.sport^sel->sport)&sel->sport_mask) &&
>- (fl->proto == sel->proto || !sel->proto) &&
>- (fl->oif == sel->ifindex || !sel->ifindex) &&
>- !memcmp(fl->fl6_src, sel->saddr.a6, sizeof(struct in6_addr));
>+ return !memcmp(fl->fl6_dst, &sel->daddr, (sel->prefixlen_d)/8) &&
>+ !memcmp(fl->fl6_src, &sel->saddr, (sel->prefixlen_s)/8) &&
>+ !((fl->uli_u.ports.dport^sel->dport)&sel->dport_mask) &&
>+ !((fl->uli_u.ports.sport^sel->sport)&sel->sport_mask) &&
>+ (fl->proto == sel->proto || !sel->proto) &&
>+ (fl->oif == sel->ifindex || !sel->ifindex);
> }
memcmp with prefixlen/8 is too generous. Orignal non mask comparison
is much worser (maybe my code...). We need bit comparison here.
Poor xfrm6_selector_match()... I only have below idea... addr_match()
is taken from ip6_fib.c...
static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
{
__u32 *a1 = token1;
__u32 *a2 = token2;
int pdw;
int pbi;
pdw = prefixlen >> 5; /* num of whole __u32 in prefix */
pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */
if (pdw)
if (memcmp(a1, a2, pdw << 2))
return 0;
if (pbi) {
__u32 mask;
mask = htonl((0xffffffff) << (32 - pbi));
if ((a1[pdw] ^ a2[pdw]) & mask)
return 0;
}
return 1;
}
static inline int
xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl)
{
return addr_match(fl->fl6_dst, &sel->daddr, sel->prefixlen_d) &&
addr_match(fl->fl6_src, &sel->saddr, sel->prefixlen_s) &&
!((fl->uli_u.ports.dport^sel->dport)&sel->dport_mask) &&
!((fl->uli_u.ports.sport^sel->sport)&sel->sport_mask) &&
(fl->proto == sel->proto || !sel->proto) &&
(fl->oif == sel->ifindex || !sel->ifindex);
}
next prev parent reply other threads:[~2003-02-19 9:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-19 4:48 [PATCH] IPv6 IPsec support Kazunori MIyazawa
2003-02-19 4:50 ` David S. Miller
2003-02-19 5:10 ` Kunihiro Ishiguro
2003-02-19 5:17 ` Mitsuru KANDA / 神田 充
2003-02-19 5:58 ` Kazunori Miyazawa
2003-02-19 5:30 ` YOSHIFUJI Hideaki / 吉藤英明
2003-02-19 5:57 ` Kunihiro Ishiguro
2003-02-19 7:02 ` David S. Miller
2003-02-19 9:13 ` Kunihiro Ishiguro [this message]
2003-02-19 7:13 ` David S. Miller
2003-02-19 7:33 ` David S. Miller
2003-02-19 14:39 ` (usagi-core 11926) " Kazunori MIyazawa
2003-02-19 21:27 ` David S. Miller
2003-02-19 16:56 ` Mitsuru KANDA / 神田 充
2003-02-19 21:43 ` David S. Miller
2003-02-19 23:10 ` Kunihiro Ishiguro
2003-02-20 0:37 ` David S. Miller
-- strict thread matches above, loose matches on Subject: below --
2003-02-22 11:26 [PATCH] IPv6 IPSEC support Kazunori Miyazawa
2003-02-22 11:13 ` David S. Miller
2003-02-22 12:15 ` Kazunori Miyazawa
2003-02-22 12:49 ` YOSHIFUJI Hideaki / 吉藤英明
2003-02-22 23:47 ` David S. Miller
2003-02-23 0:44 ` YOSHIFUJI Hideaki / 吉藤英明
2003-02-23 15:35 ` Kazunori Miyazawa
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=87of58hbu8.wl@ipinfusion.com \
--to=kunihiro@ipinfusion.com \
--cc=Kazunori.Miyazawa@jp.yokogawa.com \
--cc=davem@redhat.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@oss.sgi.com \
--cc=usagi-core@linux-ipv6.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).