[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3edc6401-cb6a-82a1-3b7b-7aa41b67d227@gmail.com>
Date: Thu, 22 Feb 2018 10:23:00 -0700
From: David Ahern <dsahern@...il.com>
To: Donald Sharp <sharpd@...ulusnetworks.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v2 iproute2-next 1/3] ip: Use the `struct fib_rule_hdr`
for rules
On 2/21/18 7:12 PM, Donald Sharp wrote:
> @@ -577,21 +585,20 @@ static int iprule_modify(int cmd, int argc, char **argv)
> __u32 tid = 0;
> struct {
> struct nlmsghdr n;
> - struct rtmsg r;
> + struct fib_rule_hdr frh;
> char buf[1024];
> } req = {
> .n.nlmsg_type = cmd,
> - .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)),
> + .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct fib_rule_hdr)),
> .n.nlmsg_flags = NLM_F_REQUEST,
> - .r.rtm_family = preferred_family,
> - .r.rtm_protocol = RTPROT_BOOT,
> - .r.rtm_scope = RT_SCOPE_UNIVERSE,
> - .r.rtm_type = RTN_UNSPEC,
> + .frh.family = preferred_family,
> + .frh.proto = RTPROT_BOOT,
> + .frh.action = RTN_UNSPEC,
> };
>
> if (cmd == RTM_NEWRULE) {
> req.n.nlmsg_flags |= NLM_F_CREATE|NLM_F_EXCL;
> - req.r.rtm_type = RTN_UNICAST;
> + req.frh.action = RTN_UNICAST;
> }
The action should be FR_ACT_TO_TBL; RTN_UNICAST == 1 == FR_ACT_TO_TBL;
the latter is the proper enum for fib rules.
Powered by blists - more mailing lists