[PATCH] libiproute: fix filtering ip6 route by table id
Denys Vlasenko
vda.linux at googlemail.com
Sun Jul 9 18:44:00 UTC 2023
Applied, thank you.
On Sun, Mar 5, 2023 at 2:38 AM Yousong Zhou <yszhou4tech at gmail.com> wrote:
>
> > > The very same code exists in current iproute2 git tree.
> > > Is it also buggy in the same way?
> >
> > Hi Denys
> >
> > I checked before and iproute2 works just fine. The code is a bit different:
>
> Friendly ping.
>
> Regards,
> yousong
>
> >
> > >
> > > iproute.c
> > > static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
> > > {
> > > struct rtmsg *r = NLMSG_DATA(n);
> > > inet_prefix dst = { .family = r->rtm_family };
> > > inet_prefix src = { .family = r->rtm_family };
> > > inet_prefix via = { .family = r->rtm_family };
> > > inet_prefix prefsrc = { .family = r->rtm_family };
> > > __u32 table;
> > > static int ip6_multiple_tables;
> > >
> > > table = rtm_get_table(r, tb);
> > >
> > > if (preferred_family != AF_UNSPEC && r->rtm_family != preferred_family)
> > > return 0;
> > >
> > > if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
> > > ip6_multiple_tables = 1;
> >
> > It sets ip6_multiple_tables here.
> >
> > >
> > > if (filter.cloned == !(r->rtm_flags & RTM_F_CLONED))
> > > return 0;
> > >
> > > if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {
> >
> > So it won't go into this branch
> >
> > > if (filter.tb) {
> > > if (filter.tb == RT_TABLE_LOCAL) {
> > > if (r->rtm_type != RTN_LOCAL)
> > > return 0;
> > > } else if (filter.tb == RT_TABLE_MAIN) {
> > > if (r->rtm_type == RTN_LOCAL)
> > > return 0;
> > > } else {
> > > return 0;
> > > }
> > > }
> > > } else {
> > > if (filter.tb > 0 && filter.tb != table)
> > > return 0;
> >
> > The check happens here.
> >
> > Regards,
> > yousong
> >
> > > }
More information about the busybox
mailing list