netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Magesh  M P" <magesh@digitizethings.com>
To: David Ahern <dsahern@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: gateway field missing in netlink message
Date: Thu, 5 May 2022 03:43:45 +0000	[thread overview]
Message-ID: <DM5PR20MB2055CCC42062AF5DB5827BAEAEC29@DM5PR20MB2055.namprd20.prod.outlook.com> (raw)
In-Reply-To: <20220504223100.GA2968@u2004-local>

Hi Dave,

Thanks for responding.

The librtnl/netns.c contains the parser code as below which parses the MULTIPATH attribute. Could you please take a look at the code and see if anything is wrong ?
static int
rtnl_parse_rtattr(struct rtattr *db[], size_t max,
                  struct rtattr *rta, size_t len) {
int attrlen;
  for(; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
    if (rta->rta_type <= max){
                clib_warning("rattr type [%d] ",rta->rta_type);
         if (rta->rta_type == RTA_TABLE) {
           unsigned int rtable=*(unsigned int*)RTA_DATA(rta);
            clib_warning("RTA_RTABLE type rtable %x\n",rtable);
           }
         if (rta->rta_type == RTA_OIF) {
           unsigned int oif=*(unsigned int*)RTA_DATA(rta);
            clib_warning("RTA_OIF type oif %x\n",oif);
           }
         if (rta->rta_type == RTA_GATEWAY) {
           unsigned int gw=*(unsigned int*)RTA_DATA(rta);
            clib_warning("RTA_GATEWAY type gateway %x\n",gw);
           }
         if (rta->rta_type == RTA_DST) {
           unsigned int destip=*(unsigned int*)RTA_DATA(rta);
            clib_warning("RTA_DST type destip %x\n",destip);
           }
         if (rta->rta_type == RTA_MULTIPATH){
          struct rtnexthop *nhptr = (struct rtnexthop*)RTA_DATA(rta);
          int rtnhp_len = RTA_PAYLOAD(rta);
                 clib_warning("RTA_MULTIPATH type\n");
           if (rtnhp_len < (int) sizeof (*nhptr) ||
              nhptr->rtnh_len > rtnhp_len){
                continue;
               }
          attrlen = rtnhp_len - sizeof(struct rtnexthop);
           if (attrlen) {
              struct rtattr *attr = RTNH_DATA(nhptr);
                for(; RTA_OK(attr,attrlen);attr=RTA_NEXT(attr, attrlen)){
                 clib_warning("attr->rta_type %d\n",attr->rta_type);
                 if (attr->rta_type == RTA_GATEWAY) {
                 unsigned int nh= *(unsigned int*) RTA_DATA(attr);
                 clib_warning("gateway %x\n",nh);
                  }
                }
             }
          }
      db[rta->rta_type] = rta;
        }
#ifdef RTNL_CHECK
    else
      clib_warning("RTA type too high: %d", rta->rta_type);
#endif
  }

  if(len) {
    clib_warning("rattr lenght mistmatch %d %d len",
                 (int) len, (int) rta->rta_len);
    return -1;
  }
  return 0;
}



From: David Ahern <dsahern@kernel.org>
Sent: Thursday, May 5, 2022 4:01 AM
To: Magesh M P <magesh@digitizethings.com>
Cc: netdev@vger.kernel.org <netdev@vger.kernel.org>
Subject: Re: gateway field missing in netlink message 
 
On Wed, May 04, 2022 at 06:46:05AM +0000, Magesh  M P wrote:
> Hi
> 
> I am trying to configure dual gateways with ip route command.
> 
> Ip route show command shows the dual gateway information.
> 
> I got a vpp stack that is running. The communication of route entries between Linux kernel and vpp stack is through netlink messages.
> 
> On parsing the netlink message for the route entry with dual gateways, we see that the message carries only single gateway. Is this a known bug ? Please suggest a solution to resolve this.
> 

If `ip route show` lists a multipath route, the bug is in your app. Are
you handling RTA_MULTIPATH attribute?

  reply	other threads:[~2022-05-05  3:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04  6:46 gateway field missing in netlink message Magesh  M P
2022-05-04 22:31 ` David Ahern
2022-05-05  3:43   ` Magesh  M P [this message]
2022-05-05  3:49     ` Stephen Hemminger
     [not found]       ` <DM5PR20MB20556090A88575E4F55F1EDAAEC29@DM5PR20MB2055.namprd20.prod.outlook.com>
     [not found]         ` <DM5PR20MB2055F01D55F6F7307B50182EAEC29@DM5PR20MB2055.namprd20.prod.outlook.com>
     [not found]           ` <20220505092851.79d3375a@hermes.local>
     [not found]             ` <DM5PR20MB2055542FB35F8CA770178F9AAEC69@DM5PR20MB2055.namprd20.prod.outlook.com>
2022-05-09  6:59               ` Magesh  M P
2022-05-09 15:32                 ` David Ahern
     [not found]               ` <20220509080511.1893a939@hermes.local>
     [not found]                 ` <DM5PR20MB2055EBCA16DFB527A7E9A32FAEC89@DM5PR20MB2055.namprd20.prod.outlook.com>
2022-05-11  5:35                   ` Magesh  M P
2022-05-11 15:56                     ` Stephen Hemminger
2022-05-11 16:25                       ` David Ahern
2022-05-05  3:50     ` Stephen Hemminger
2022-05-05  4:14       ` Magesh  M P
2022-05-05  4:13     ` David Ahern
2022-05-12  6:33 Magesh  M P
2022-05-19  6:11 Magesh  M P

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=DM5PR20MB2055CCC42062AF5DB5827BAEAEC29@DM5PR20MB2055.namprd20.prod.outlook.com \
    --to=magesh@digitizethings.com \
    --cc=dsahern@kernel.org \
    --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).