Return-Path: Received: from mail-pg0-f49.google.com ([74.125.83.49]:35533 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933386AbeBVRXD (ORCPT ); Thu, 22 Feb 2018 12:23:03 -0500 Received: by mail-pg0-f49.google.com with SMTP id l131so2254413pga.2 for ; Thu, 22 Feb 2018 09:23:03 -0800 (PST) Subject: Re: [PATCH v2 iproute2-next 1/3] ip: Use the `struct fib_rule_hdr` for rules To: Donald Sharp , netdev@vger.kernel.org References: <20180221015348.32646-1-sharpd@cumulusnetworks.com> <20180222021218.12948-2-sharpd@cumulusnetworks.com> From: David Ahern Message-ID: <3edc6401-cb6a-82a1-3b7b-7aa41b67d227@gmail.com> Date: Thu, 22 Feb 2018 10:23:00 -0700 MIME-Version: 1.0 In-Reply-To: <20180222021218.12948-2-sharpd@cumulusnetworks.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: 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.