[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 5 May 2022 03:43:45 +0000
From: "Magesh M P" <magesh@...itizethings.com>
To: David Ahern <dsahern@...nel.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: gateway field missing in netlink message
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@...nel.org>
Sent: Thursday, May 5, 2022 4:01 AM
To: Magesh M P <magesh@...itizethings.com>
Cc: netdev@...r.kernel.org <netdev@...r.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?
Powered by blists - more mailing lists