All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] fib: remove suppress indirection, merge nl policies
@ 2021-12-13 15:31 Florian Westphal
  2021-12-13 15:31 ` [PATCH net-next 1/4] fib: remove suppress indirection Florian Westphal
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Florian Westphal @ 2021-12-13 15:31 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, dsahern, Florian Westphal

This series removes the 'suppress' indirection in fib_rule_ops struct
and merges the different (largely identical) nla policies.

Florian Westphal (4):
  fib: remove suppress indirection
  fib: place common code in a helper
  fib: rules: remove duplicated nla policies
  fib: expand fib_rule_policy

 include/net/fib_rules.h |  30 -----------
 net/core/fib_rules.c    | 107 +++++++++++++++++++++++++++++++++++++---
 net/decnet/dn_rules.c   |   5 --
 net/ipv4/fib_rules.c    |  40 ---------------
 net/ipv4/ipmr.c         |   5 --
 net/ipv6/fib6_rules.c   |  39 ---------------
 net/ipv6/ip6mr.c        |   5 --
 7 files changed, 101 insertions(+), 130 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH net-next 1/4] fib: remove suppress indirection
  2021-12-13 15:31 [PATCH net-next 0/4] fib: remove suppress indirection, merge nl policies Florian Westphal
@ 2021-12-13 15:31 ` Florian Westphal
  2021-12-13 20:39     ` kernel test robot
                     ` (2 more replies)
  2021-12-13 15:31 ` [PATCH net-next 2/4] fib: place common code in a helper Florian Westphal
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 11+ messages in thread
From: Florian Westphal @ 2021-12-13 15:31 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, dsahern, Florian Westphal

Only used by ipv4 and ipv6.
Both functions are small and do not use any internal data
structures.  Move this to core and remove the indirection.

Object size increase is small:
before:
   text	   data	    bss	    dec	    hex	filename
  10335	    158	      0	  10493	   28fd	fib_rules.o
after:
  10615	    158	      0	  10773	   2a15	fib_rules.o

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 include/net/fib_rules.h |  9 -----
 net/core/fib_rules.c    | 86 +++++++++++++++++++++++++++++++++++++++--
 net/ipv4/fib_rules.c    | 34 ----------------
 net/ipv6/fib6_rules.c   | 34 ----------------
 4 files changed, 82 insertions(+), 81 deletions(-)

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index bd07484ab9dd..d15e5638b937 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -69,8 +69,6 @@ struct fib_rules_ops {
 	int			(*action)(struct fib_rule *,
 					  struct flowi *, int,
 					  struct fib_lookup_arg *);
-	bool			(*suppress)(struct fib_rule *, int,
-					    struct fib_lookup_arg *);
 	int			(*match)(struct fib_rule *,
 					 struct flowi *, int);
 	int			(*configure)(struct fib_rule *,
@@ -216,11 +214,4 @@ INDIRECT_CALLABLE_DECLARE(int fib6_rule_action(struct fib_rule *rule,
 INDIRECT_CALLABLE_DECLARE(int fib4_rule_action(struct fib_rule *rule,
 			    struct flowi *flp, int flags,
 			    struct fib_lookup_arg *arg));
-
-INDIRECT_CALLABLE_DECLARE(bool fib6_rule_suppress(struct fib_rule *rule,
-						int flags,
-						struct fib_lookup_arg *arg));
-INDIRECT_CALLABLE_DECLARE(bool fib4_rule_suppress(struct fib_rule *rule,
-						int flags,
-						struct fib_lookup_arg *arg));
 #endif
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 1bb567a3b329..b98afe59a4f1 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -289,6 +289,87 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
 	return (rule->flags & FIB_RULE_INVERT) ? !ret : ret;
 }
 
+static bool fib4_rule_suppress(struct fib_rule *rule,
+			       int flags,
+			       struct fib_lookup_arg *arg)
+{
+	struct fib_result *result = (struct fib_result *)arg->result;
+	struct net_device *dev = NULL;
+
+	if (result->fi) {
+		struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
+
+		dev = nhc->nhc_dev;
+	}
+
+	/* do not accept result if the route does
+	 * not meet the required prefix length
+	 */
+	if (result->prefixlen <= rule->suppress_prefixlen)
+		goto suppress_route;
+
+	/* do not accept result if the route uses a device
+	 * belonging to a forbidden interface group
+	 */
+	if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
+		goto suppress_route;
+
+	return false;
+
+suppress_route:
+	if (!(arg->flags & FIB_LOOKUP_NOREF))
+		fib_info_put(result->fi);
+	return true;
+}
+
+static bool fib6_rule_suppress(struct fib_rule *rule,
+			       int flags,
+			       struct fib_lookup_arg *arg)
+{
+	struct fib6_result *res = arg->result;
+	struct rt6_info *rt = res->rt6;
+	struct net_device *dev = NULL;
+
+	if (!rt)
+		return false;
+
+	if (rt->rt6i_idev)
+		dev = rt->rt6i_idev->dev;
+
+	/* do not accept result if the route does
+	 * not meet the required prefix length
+	 */
+	if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
+		goto suppress_route;
+
+	/* do not accept result if the route uses a device
+	 * belonging to a forbidden interface group
+	 */
+	if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
+		goto suppress_route;
+
+	return false;
+
+suppress_route:
+	ip6_rt_put_flags(rt, flags);
+	return true;
+}
+
+static bool fib_rule_suppress(int family,
+			      struct fib_rule *rule,
+			      int flags,
+			      struct fib_lookup_arg *arg)
+{
+	switch (family) {
+	case AF_INET:
+		return fib4_rule_suppress(rule, flags, arg);
+	case AF_INET6:
+		return fib6_rule_suppress(rule, flags, arg);
+	}
+
+	return false;
+}
+
 int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
 		     int flags, struct fib_lookup_arg *arg)
 {
@@ -320,10 +401,7 @@ int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
 					       fib4_rule_action,
 					       rule, fl, flags, arg);
 
-		if (!err && ops->suppress && INDIRECT_CALL_MT(ops->suppress,
-							      fib6_rule_suppress,
-							      fib4_rule_suppress,
-							      rule, flags, arg))
+		if (!err && fib_rule_suppress(ops->family, rule, flags, arg))
 			continue;
 
 		if (err != -EAGAIN) {
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index d279cb8ac158..560702a9bed4 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -140,39 +140,6 @@ INDIRECT_CALLABLE_SCOPE int fib4_rule_action(struct fib_rule *rule,
 	return err;
 }
 
-INDIRECT_CALLABLE_SCOPE bool fib4_rule_suppress(struct fib_rule *rule,
-						int flags,
-						struct fib_lookup_arg *arg)
-{
-	struct fib_result *result = (struct fib_result *) arg->result;
-	struct net_device *dev = NULL;
-
-	if (result->fi) {
-		struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
-
-		dev = nhc->nhc_dev;
-	}
-
-	/* do not accept result if the route does
-	 * not meet the required prefix length
-	 */
-	if (result->prefixlen <= rule->suppress_prefixlen)
-		goto suppress_route;
-
-	/* do not accept result if the route uses a device
-	 * belonging to a forbidden interface group
-	 */
-	if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
-		goto suppress_route;
-
-	return false;
-
-suppress_route:
-	if (!(arg->flags & FIB_LOOKUP_NOREF))
-		fib_info_put(result->fi);
-	return true;
-}
-
 INDIRECT_CALLABLE_SCOPE int fib4_rule_match(struct fib_rule *rule,
 					    struct flowi *fl, int flags)
 {
@@ -377,7 +344,6 @@ static const struct fib_rules_ops __net_initconst fib4_rules_ops_template = {
 	.rule_size	= sizeof(struct fib4_rule),
 	.addr_size	= sizeof(u32),
 	.action		= fib4_rule_action,
-	.suppress	= fib4_rule_suppress,
 	.match		= fib4_rule_match,
 	.configure	= fib4_rule_configure,
 	.delete		= fib4_rule_delete,
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index dcedfe29d9d9..6b6718844fee 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -266,39 +266,6 @@ INDIRECT_CALLABLE_SCOPE int fib6_rule_action(struct fib_rule *rule,
 	return __fib6_rule_action(rule, flp, flags, arg);
 }
 
-INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule,
-						int flags,
-						struct fib_lookup_arg *arg)
-{
-	struct fib6_result *res = arg->result;
-	struct rt6_info *rt = res->rt6;
-	struct net_device *dev = NULL;
-
-	if (!rt)
-		return false;
-
-	if (rt->rt6i_idev)
-		dev = rt->rt6i_idev->dev;
-
-	/* do not accept result if the route does
-	 * not meet the required prefix length
-	 */
-	if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
-		goto suppress_route;
-
-	/* do not accept result if the route uses a device
-	 * belonging to a forbidden interface group
-	 */
-	if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
-		goto suppress_route;
-
-	return false;
-
-suppress_route:
-	ip6_rt_put_flags(rt, flags);
-	return true;
-}
-
 INDIRECT_CALLABLE_SCOPE int fib6_rule_match(struct fib_rule *rule,
 					    struct flowi *fl, int flags)
 {
@@ -452,7 +419,6 @@ static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = {
 	.addr_size		= sizeof(struct in6_addr),
 	.action			= fib6_rule_action,
 	.match			= fib6_rule_match,
-	.suppress		= fib6_rule_suppress,
 	.configure		= fib6_rule_configure,
 	.delete			= fib6_rule_delete,
 	.compare		= fib6_rule_compare,
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH net-next 2/4] fib: place common code in a helper
  2021-12-13 15:31 [PATCH net-next 0/4] fib: remove suppress indirection, merge nl policies Florian Westphal
  2021-12-13 15:31 ` [PATCH net-next 1/4] fib: remove suppress indirection Florian Westphal
@ 2021-12-13 15:31 ` Florian Westphal
  2021-12-13 15:31 ` [PATCH net-next 3/4] fib: rules: remove duplicated nla policies Florian Westphal
  2021-12-13 15:31 ` [PATCH net-next 4/4] fib: expand fib_rule_policy Florian Westphal
  3 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2021-12-13 15:31 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, dsahern, Florian Westphal

After moving the ipv4/ipv6 helpers to the core, there is some
overlapping code that can be collapsed into a helper.

This change has no effect on generated code.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/core/fib_rules.c | 60 +++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 32 deletions(-)

diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index b98afe59a4f1..443405c579ee 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -289,6 +289,25 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
 	return (rule->flags & FIB_RULE_INVERT) ? !ret : ret;
 }
 
+static bool fib_rule_should_suppress(const struct fib_rule *rule,
+				     const struct net_device *dev,
+				     int prefixlen)
+{
+	/* do not accept result if the route does
+	 * not meet the required prefix length
+	 */
+	if (prefixlen <= rule->suppress_prefixlen)
+		return true;
+
+	/* do not accept result if the route uses a device
+	 * belonging to a forbidden interface group
+	 */
+	if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
+		return true;
+
+	return false;
+}
+
 static bool fib4_rule_suppress(struct fib_rule *rule,
 			       int flags,
 			       struct fib_lookup_arg *arg)
@@ -302,24 +321,12 @@ static bool fib4_rule_suppress(struct fib_rule *rule,
 		dev = nhc->nhc_dev;
 	}
 
-	/* do not accept result if the route does
-	 * not meet the required prefix length
-	 */
-	if (result->prefixlen <= rule->suppress_prefixlen)
-		goto suppress_route;
-
-	/* do not accept result if the route uses a device
-	 * belonging to a forbidden interface group
-	 */
-	if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
-		goto suppress_route;
-
+	if (fib_rule_should_suppress(rule, dev, result->prefixlen)) {
+		if (!(arg->flags & FIB_LOOKUP_NOREF))
+			fib_info_put(result->fi);
+		return true;
+	}
 	return false;
-
-suppress_route:
-	if (!(arg->flags & FIB_LOOKUP_NOREF))
-		fib_info_put(result->fi);
-	return true;
 }
 
 static bool fib6_rule_suppress(struct fib_rule *rule,
@@ -336,23 +343,12 @@ static bool fib6_rule_suppress(struct fib_rule *rule,
 	if (rt->rt6i_idev)
 		dev = rt->rt6i_idev->dev;
 
-	/* do not accept result if the route does
-	 * not meet the required prefix length
-	 */
-	if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
-		goto suppress_route;
-
-	/* do not accept result if the route uses a device
-	 * belonging to a forbidden interface group
-	 */
-	if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
-		goto suppress_route;
+	if (fib_rule_should_suppress(rule, dev, rt->rt6i_dst.plen)) {
+		ip6_rt_put_flags(rt, flags);
+		return true;
+	}
 
 	return false;
-
-suppress_route:
-	ip6_rt_put_flags(rt, flags);
-	return true;
 }
 
 static bool fib_rule_suppress(int family,
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH net-next 3/4] fib: rules: remove duplicated nla policies
  2021-12-13 15:31 [PATCH net-next 0/4] fib: remove suppress indirection, merge nl policies Florian Westphal
  2021-12-13 15:31 ` [PATCH net-next 1/4] fib: remove suppress indirection Florian Westphal
  2021-12-13 15:31 ` [PATCH net-next 2/4] fib: place common code in a helper Florian Westphal
@ 2021-12-13 15:31 ` Florian Westphal
  2021-12-13 15:31 ` [PATCH net-next 4/4] fib: expand fib_rule_policy Florian Westphal
  3 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2021-12-13 15:31 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, dsahern, Florian Westphal

The attributes are identical in all implementations so move the ipv4 one
into the core and remove the per-family nla policies.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 include/net/fib_rules.h | 1 -
 net/core/fib_rules.c    | 9 +++++++--
 net/decnet/dn_rules.c   | 5 -----
 net/ipv4/fib_rules.c    | 6 ------
 net/ipv4/ipmr.c         | 5 -----
 net/ipv6/fib6_rules.c   | 5 -----
 net/ipv6/ip6mr.c        | 5 -----
 7 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index d15e5638b937..08b85a4eedcc 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -89,7 +89,6 @@ struct fib_rules_ops {
 	void			(*flush_cache)(struct fib_rules_ops *ops);
 
 	int			nlgroup;
-	const struct nla_policy	*policy;
 	struct list_head	rules_list;
 	struct module		*owner;
 	struct net		*fro_net;
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 443405c579ee..2ee8bd067afc 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -824,6 +824,11 @@ static int rule_exists(struct fib_rules_ops *ops, struct fib_rule_hdr *frh,
 	return 0;
 }
 
+static const struct nla_policy fib_rule_policy[FRA_MAX + 1] = {
+	FRA_GENERIC_POLICY,
+	[FRA_FLOW]	= { .type = NLA_U32 },
+};
+
 int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
 		   struct netlink_ext_ack *extack)
 {
@@ -848,7 +853,7 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
 	}
 
 	err = nlmsg_parse_deprecated(nlh, sizeof(*frh), tb, FRA_MAX,
-				     ops->policy, extack);
+				     fib_rule_policy, extack);
 	if (err < 0) {
 		NL_SET_ERR_MSG(extack, "Error parsing msg");
 		goto errout;
@@ -956,7 +961,7 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh,
 	}
 
 	err = nlmsg_parse_deprecated(nlh, sizeof(*frh), tb, FRA_MAX,
-				     ops->policy, extack);
+				     fib_rule_policy, extack);
 	if (err < 0) {
 		NL_SET_ERR_MSG(extack, "Error parsing msg");
 		goto errout;
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 4a4e3c17740c..ee73057529cf 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -101,10 +101,6 @@ static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp,
 	return err;
 }
 
-static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = {
-	FRA_GENERIC_POLICY,
-};
-
 static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
 {
 	struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
@@ -235,7 +231,6 @@ static const struct fib_rules_ops __net_initconst dn_fib_rules_ops_template = {
 	.fill		= dn_fib_rule_fill,
 	.flush_cache	= dn_fib_rule_flush_cache,
 	.nlgroup	= RTNLGRP_DECnet_RULE,
-	.policy		= dn_fib_rule_policy,
 	.owner		= THIS_MODULE,
 	.fro_net	= &init_net,
 };
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 560702a9bed4..cf873b0788a3 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -183,11 +183,6 @@ static struct fib_table *fib_empty_table(struct net *net)
 	return NULL;
 }
 
-static const struct nla_policy fib4_rule_policy[FRA_MAX+1] = {
-	FRA_GENERIC_POLICY,
-	[FRA_FLOW]	= { .type = NLA_U32 },
-};
-
 static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
 			       struct fib_rule_hdr *frh,
 			       struct nlattr **tb,
@@ -352,7 +347,6 @@ static const struct fib_rules_ops __net_initconst fib4_rules_ops_template = {
 	.nlmsg_payload	= fib4_rule_nlmsg_payload,
 	.flush_cache	= fib4_rule_flush_cache,
 	.nlgroup	= RTNLGRP_IPV4_RULE,
-	.policy		= fib4_rule_policy,
 	.owner		= THIS_MODULE,
 };
 
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 4c7aca884fa9..07274619b9ea 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -195,10 +195,6 @@ static int ipmr_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
 	return 1;
 }
 
-static const struct nla_policy ipmr_rule_policy[FRA_MAX + 1] = {
-	FRA_GENERIC_POLICY,
-};
-
 static int ipmr_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
 			       struct fib_rule_hdr *frh, struct nlattr **tb,
 			       struct netlink_ext_ack *extack)
@@ -231,7 +227,6 @@ static const struct fib_rules_ops __net_initconst ipmr_rules_ops_template = {
 	.compare	= ipmr_rule_compare,
 	.fill		= ipmr_rule_fill,
 	.nlgroup	= RTNLGRP_IPV4_RULE,
-	.policy		= ipmr_rule_policy,
 	.owner		= THIS_MODULE,
 };
 
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 6b6718844fee..26da672f4d00 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -307,10 +307,6 @@ INDIRECT_CALLABLE_SCOPE int fib6_rule_match(struct fib_rule *rule,
 	return 1;
 }
 
-static const struct nla_policy fib6_rule_policy[FRA_MAX+1] = {
-	FRA_GENERIC_POLICY,
-};
-
 static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
 			       struct fib_rule_hdr *frh,
 			       struct nlattr **tb,
@@ -425,7 +421,6 @@ static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = {
 	.fill			= fib6_rule_fill,
 	.nlmsg_payload		= fib6_rule_nlmsg_payload,
 	.nlgroup		= RTNLGRP_IPV6_RULE,
-	.policy			= fib6_rule_policy,
 	.owner			= THIS_MODULE,
 	.fro_net		= &init_net,
 };
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index a77a15a7f3dc..7cf73e60e619 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -182,10 +182,6 @@ static int ip6mr_rule_match(struct fib_rule *rule, struct flowi *flp, int flags)
 	return 1;
 }
 
-static const struct nla_policy ip6mr_rule_policy[FRA_MAX + 1] = {
-	FRA_GENERIC_POLICY,
-};
-
 static int ip6mr_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
 				struct fib_rule_hdr *frh, struct nlattr **tb,
 				struct netlink_ext_ack *extack)
@@ -218,7 +214,6 @@ static const struct fib_rules_ops __net_initconst ip6mr_rules_ops_template = {
 	.compare	= ip6mr_rule_compare,
 	.fill		= ip6mr_rule_fill,
 	.nlgroup	= RTNLGRP_IPV6_RULE,
-	.policy		= ip6mr_rule_policy,
 	.owner		= THIS_MODULE,
 };
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH net-next 4/4] fib: expand fib_rule_policy
  2021-12-13 15:31 [PATCH net-next 0/4] fib: remove suppress indirection, merge nl policies Florian Westphal
                   ` (2 preceding siblings ...)
  2021-12-13 15:31 ` [PATCH net-next 3/4] fib: rules: remove duplicated nla policies Florian Westphal
@ 2021-12-13 15:31 ` Florian Westphal
  3 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2021-12-13 15:31 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, dsahern, Florian Westphal

Now that there is only one fib nla_policy there is no need to
keep the macro around.  Place it where its used.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 include/net/fib_rules.h | 20 --------------------
 net/core/fib_rules.c    | 18 +++++++++++++++++-
 2 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 08b85a4eedcc..27dbff62b5c2 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -100,26 +100,6 @@ struct fib_rule_notifier_info {
 	struct fib_rule *rule;
 };
 
-#define FRA_GENERIC_POLICY \
-	[FRA_UNSPEC]	= { .strict_start_type = FRA_DPORT_RANGE + 1 }, \
-	[FRA_IIFNAME]	= { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
-	[FRA_OIFNAME]	= { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
-	[FRA_PRIORITY]	= { .type = NLA_U32 }, \
-	[FRA_FWMARK]	= { .type = NLA_U32 }, \
-	[FRA_TUN_ID]	= { .type = NLA_U64 }, \
-	[FRA_FWMASK]	= { .type = NLA_U32 }, \
-	[FRA_TABLE]     = { .type = NLA_U32 }, \
-	[FRA_SUPPRESS_PREFIXLEN] = { .type = NLA_U32 }, \
-	[FRA_SUPPRESS_IFGROUP] = { .type = NLA_U32 }, \
-	[FRA_GOTO]	= { .type = NLA_U32 }, \
-	[FRA_L3MDEV]	= { .type = NLA_U8 }, \
-	[FRA_UID_RANGE]	= { .len = sizeof(struct fib_rule_uid_range) }, \
-	[FRA_PROTOCOL]  = { .type = NLA_U8 }, \
-	[FRA_IP_PROTO]  = { .type = NLA_U8 }, \
-	[FRA_SPORT_RANGE] = { .len = sizeof(struct fib_rule_port_range) }, \
-	[FRA_DPORT_RANGE] = { .len = sizeof(struct fib_rule_port_range) }
-
-
 static inline void fib_rule_get(struct fib_rule *rule)
 {
 	refcount_inc(&rule->refcnt);
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 2ee8bd067afc..5ed0ff875898 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -825,8 +825,24 @@ static int rule_exists(struct fib_rules_ops *ops, struct fib_rule_hdr *frh,
 }
 
 static const struct nla_policy fib_rule_policy[FRA_MAX + 1] = {
-	FRA_GENERIC_POLICY,
+	[FRA_UNSPEC]	= { .strict_start_type = FRA_DPORT_RANGE + 1 },
+	[FRA_IIFNAME]	= { .type = NLA_STRING, .len = IFNAMSIZ - 1 },
+	[FRA_OIFNAME]	= { .type = NLA_STRING, .len = IFNAMSIZ - 1 },
+	[FRA_PRIORITY]	= { .type = NLA_U32 },
+	[FRA_FWMARK]	= { .type = NLA_U32 },
 	[FRA_FLOW]	= { .type = NLA_U32 },
+	[FRA_TUN_ID]	= { .type = NLA_U64 },
+	[FRA_FWMASK]	= { .type = NLA_U32 },
+	[FRA_TABLE]     = { .type = NLA_U32 },
+	[FRA_SUPPRESS_PREFIXLEN] = { .type = NLA_U32 },
+	[FRA_SUPPRESS_IFGROUP] = { .type = NLA_U32 },
+	[FRA_GOTO]	= { .type = NLA_U32 },
+	[FRA_L3MDEV]	= { .type = NLA_U8 },
+	[FRA_UID_RANGE]	= { .len = sizeof(struct fib_rule_uid_range) },
+	[FRA_PROTOCOL]  = { .type = NLA_U8 },
+	[FRA_IP_PROTO]  = { .type = NLA_U8 },
+	[FRA_SPORT_RANGE] = { .len = sizeof(struct fib_rule_port_range) },
+	[FRA_DPORT_RANGE] = { .len = sizeof(struct fib_rule_port_range) }
 };
 
 int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next 1/4] fib: remove suppress indirection
  2021-12-13 15:31 ` [PATCH net-next 1/4] fib: remove suppress indirection Florian Westphal
@ 2021-12-13 20:39     ` kernel test robot
  2021-12-13 21:03     ` kernel test robot
  2021-12-13 21:14     ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-12-13 20:39 UTC (permalink / raw)
  To: Florian Westphal, netdev
  Cc: llvm, kbuild-all, davem, kuba, dsahern, Florian Westphal

Hi Florian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 97884b07122aabb2d6891ce17f54e0e8e94d0bc5
config: i386-randconfig-a001-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140418.ghGEE99T-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/585507534b121a41b45edaec79fe6c3d94a50b5f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
        git checkout 585507534b121a41b45edaec79fe6c3d94a50b5f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   net/core/fib_rules.c:300:31: error: implicit declaration of function 'fib_info_nhc' [-Werror,-Wimplicit-function-declaration]
                   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
                                               ^
   net/core/fib_rules.c:300:31: note: did you mean 'fib_info_put'?
   include/net/ip_fib.h:574:20: note: 'fib_info_put' declared here
   static inline void fib_info_put(struct fib_info *fi)
                      ^
>> net/core/fib_rules.c:300:25: warning: incompatible integer to pointer conversion initializing 'struct fib_nh_common *' with an expression of type 'int' [-Wint-conversion]
                   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
                                         ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/fib_rules.c:330:27: error: incomplete definition of type 'struct fib6_result'
           struct rt6_info *rt = res->rt6;
                                 ~~~^
   include/net/ipv6_stubs.h:17:8: note: forward declaration of 'struct fib6_result'
   struct fib6_result;
          ^
   net/core/fib_rules.c:336:8: error: incomplete definition of type 'struct rt6_info'
           if (rt->rt6i_idev)
               ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:337:11: error: incomplete definition of type 'struct rt6_info'
                   dev = rt->rt6i_idev->dev;
                         ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:342:8: error: incomplete definition of type 'struct rt6_info'
           if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
               ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:354:2: error: implicit declaration of function 'ip6_rt_put_flags' [-Werror,-Wimplicit-function-declaration]
           ip6_rt_put_flags(rt, flags);
           ^
   1 warning and 6 errors generated.


vim +300 net/core/fib_rules.c

   291	
   292	static bool fib4_rule_suppress(struct fib_rule *rule,
   293				       int flags,
   294				       struct fib_lookup_arg *arg)
   295	{
   296		struct fib_result *result = (struct fib_result *)arg->result;
   297		struct net_device *dev = NULL;
   298	
   299		if (result->fi) {
 > 300			struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
   301	
   302			dev = nhc->nhc_dev;
   303		}
   304	
   305		/* do not accept result if the route does
   306		 * not meet the required prefix length
   307		 */
   308		if (result->prefixlen <= rule->suppress_prefixlen)
   309			goto suppress_route;
   310	
   311		/* do not accept result if the route uses a device
   312		 * belonging to a forbidden interface group
   313		 */
   314		if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
   315			goto suppress_route;
   316	
   317		return false;
   318	
   319	suppress_route:
   320		if (!(arg->flags & FIB_LOOKUP_NOREF))
   321			fib_info_put(result->fi);
   322		return true;
   323	}
   324	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next 1/4] fib: remove suppress indirection
@ 2021-12-13 20:39     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-12-13 20:39 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4990 bytes --]

Hi Florian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 97884b07122aabb2d6891ce17f54e0e8e94d0bc5
config: i386-randconfig-a001-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140418.ghGEE99T-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/585507534b121a41b45edaec79fe6c3d94a50b5f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
        git checkout 585507534b121a41b45edaec79fe6c3d94a50b5f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   net/core/fib_rules.c:300:31: error: implicit declaration of function 'fib_info_nhc' [-Werror,-Wimplicit-function-declaration]
                   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
                                               ^
   net/core/fib_rules.c:300:31: note: did you mean 'fib_info_put'?
   include/net/ip_fib.h:574:20: note: 'fib_info_put' declared here
   static inline void fib_info_put(struct fib_info *fi)
                      ^
>> net/core/fib_rules.c:300:25: warning: incompatible integer to pointer conversion initializing 'struct fib_nh_common *' with an expression of type 'int' [-Wint-conversion]
                   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
                                         ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/fib_rules.c:330:27: error: incomplete definition of type 'struct fib6_result'
           struct rt6_info *rt = res->rt6;
                                 ~~~^
   include/net/ipv6_stubs.h:17:8: note: forward declaration of 'struct fib6_result'
   struct fib6_result;
          ^
   net/core/fib_rules.c:336:8: error: incomplete definition of type 'struct rt6_info'
           if (rt->rt6i_idev)
               ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:337:11: error: incomplete definition of type 'struct rt6_info'
                   dev = rt->rt6i_idev->dev;
                         ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:342:8: error: incomplete definition of type 'struct rt6_info'
           if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
               ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:354:2: error: implicit declaration of function 'ip6_rt_put_flags' [-Werror,-Wimplicit-function-declaration]
           ip6_rt_put_flags(rt, flags);
           ^
   1 warning and 6 errors generated.


vim +300 net/core/fib_rules.c

   291	
   292	static bool fib4_rule_suppress(struct fib_rule *rule,
   293				       int flags,
   294				       struct fib_lookup_arg *arg)
   295	{
   296		struct fib_result *result = (struct fib_result *)arg->result;
   297		struct net_device *dev = NULL;
   298	
   299		if (result->fi) {
 > 300			struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
   301	
   302			dev = nhc->nhc_dev;
   303		}
   304	
   305		/* do not accept result if the route does
   306		 * not meet the required prefix length
   307		 */
   308		if (result->prefixlen <= rule->suppress_prefixlen)
   309			goto suppress_route;
   310	
   311		/* do not accept result if the route uses a device
   312		 * belonging to a forbidden interface group
   313		 */
   314		if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
   315			goto suppress_route;
   316	
   317		return false;
   318	
   319	suppress_route:
   320		if (!(arg->flags & FIB_LOOKUP_NOREF))
   321			fib_info_put(result->fi);
   322		return true;
   323	}
   324	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next 1/4] fib: remove suppress indirection
  2021-12-13 15:31 ` [PATCH net-next 1/4] fib: remove suppress indirection Florian Westphal
@ 2021-12-13 21:03     ` kernel test robot
  2021-12-13 21:03     ` kernel test robot
  2021-12-13 21:14     ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-12-13 21:03 UTC (permalink / raw)
  To: Florian Westphal, netdev
  Cc: kbuild-all, davem, kuba, dsahern, Florian Westphal

Hi Florian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 97884b07122aabb2d6891ce17f54e0e8e94d0bc5
config: i386-randconfig-a015-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140516.lS6zCrEh-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/585507534b121a41b45edaec79fe6c3d94a50b5f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
        git checkout 585507534b121a41b45edaec79fe6c3d94a50b5f
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   net/core/fib_rules.c: In function 'fib4_rule_suppress':
   net/core/fib_rules.c:300:31: error: implicit declaration of function 'fib_info_nhc'; did you mean 'fib_info_put'? [-Werror=implicit-function-declaration]
     300 |   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
         |                               ^~~~~~~~~~~~
         |                               fib_info_put
>> net/core/fib_rules.c:300:31: warning: initialization of 'struct fib_nh_common *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   net/core/fib_rules.c: In function 'fib6_rule_suppress':
   net/core/fib_rules.c:330:27: error: dereferencing pointer to incomplete type 'struct fib6_result'
     330 |  struct rt6_info *rt = res->rt6;
         |                           ^~
   net/core/fib_rules.c:336:8: error: dereferencing pointer to incomplete type 'struct rt6_info'
     336 |  if (rt->rt6i_idev)
         |        ^~
   net/core/fib_rules.c:354:2: error: implicit declaration of function 'ip6_rt_put_flags' [-Werror=implicit-function-declaration]
     354 |  ip6_rt_put_flags(rt, flags);
         |  ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +300 net/core/fib_rules.c

   291	
   292	static bool fib4_rule_suppress(struct fib_rule *rule,
   293				       int flags,
   294				       struct fib_lookup_arg *arg)
   295	{
   296		struct fib_result *result = (struct fib_result *)arg->result;
   297		struct net_device *dev = NULL;
   298	
   299		if (result->fi) {
 > 300			struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
   301	
   302			dev = nhc->nhc_dev;
   303		}
   304	
   305		/* do not accept result if the route does
   306		 * not meet the required prefix length
   307		 */
   308		if (result->prefixlen <= rule->suppress_prefixlen)
   309			goto suppress_route;
   310	
   311		/* do not accept result if the route uses a device
   312		 * belonging to a forbidden interface group
   313		 */
   314		if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
   315			goto suppress_route;
   316	
   317		return false;
   318	
   319	suppress_route:
   320		if (!(arg->flags & FIB_LOOKUP_NOREF))
   321			fib_info_put(result->fi);
   322		return true;
   323	}
   324	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next 1/4] fib: remove suppress indirection
@ 2021-12-13 21:03     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-12-13 21:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3664 bytes --]

Hi Florian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 97884b07122aabb2d6891ce17f54e0e8e94d0bc5
config: i386-randconfig-a015-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140516.lS6zCrEh-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/585507534b121a41b45edaec79fe6c3d94a50b5f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
        git checkout 585507534b121a41b45edaec79fe6c3d94a50b5f
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   net/core/fib_rules.c: In function 'fib4_rule_suppress':
   net/core/fib_rules.c:300:31: error: implicit declaration of function 'fib_info_nhc'; did you mean 'fib_info_put'? [-Werror=implicit-function-declaration]
     300 |   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
         |                               ^~~~~~~~~~~~
         |                               fib_info_put
>> net/core/fib_rules.c:300:31: warning: initialization of 'struct fib_nh_common *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   net/core/fib_rules.c: In function 'fib6_rule_suppress':
   net/core/fib_rules.c:330:27: error: dereferencing pointer to incomplete type 'struct fib6_result'
     330 |  struct rt6_info *rt = res->rt6;
         |                           ^~
   net/core/fib_rules.c:336:8: error: dereferencing pointer to incomplete type 'struct rt6_info'
     336 |  if (rt->rt6i_idev)
         |        ^~
   net/core/fib_rules.c:354:2: error: implicit declaration of function 'ip6_rt_put_flags' [-Werror=implicit-function-declaration]
     354 |  ip6_rt_put_flags(rt, flags);
         |  ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +300 net/core/fib_rules.c

   291	
   292	static bool fib4_rule_suppress(struct fib_rule *rule,
   293				       int flags,
   294				       struct fib_lookup_arg *arg)
   295	{
   296		struct fib_result *result = (struct fib_result *)arg->result;
   297		struct net_device *dev = NULL;
   298	
   299		if (result->fi) {
 > 300			struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
   301	
   302			dev = nhc->nhc_dev;
   303		}
   304	
   305		/* do not accept result if the route does
   306		 * not meet the required prefix length
   307		 */
   308		if (result->prefixlen <= rule->suppress_prefixlen)
   309			goto suppress_route;
   310	
   311		/* do not accept result if the route uses a device
   312		 * belonging to a forbidden interface group
   313		 */
   314		if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
   315			goto suppress_route;
   316	
   317		return false;
   318	
   319	suppress_route:
   320		if (!(arg->flags & FIB_LOOKUP_NOREF))
   321			fib_info_put(result->fi);
   322		return true;
   323	}
   324	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next 1/4] fib: remove suppress indirection
  2021-12-13 15:31 ` [PATCH net-next 1/4] fib: remove suppress indirection Florian Westphal
@ 2021-12-13 21:14     ` kernel test robot
  2021-12-13 21:03     ` kernel test robot
  2021-12-13 21:14     ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-12-13 21:14 UTC (permalink / raw)
  To: Florian Westphal, netdev
  Cc: llvm, kbuild-all, davem, kuba, dsahern, Florian Westphal

Hi Florian,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 97884b07122aabb2d6891ce17f54e0e8e94d0bc5
config: hexagon-randconfig-r041-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140528.DqSB8cFq-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/585507534b121a41b45edaec79fe6c3d94a50b5f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
        git checkout 585507534b121a41b45edaec79fe6c3d94a50b5f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> net/core/fib_rules.c:300:31: error: implicit declaration of function 'fib_info_nhc' [-Werror,-Wimplicit-function-declaration]
                   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
                                               ^
   net/core/fib_rules.c:300:31: note: did you mean 'fib_info_put'?
   include/net/ip_fib.h:574:20: note: 'fib_info_put' declared here
   static inline void fib_info_put(struct fib_info *fi)
                      ^
>> net/core/fib_rules.c:300:25: warning: incompatible integer to pointer conversion initializing 'struct fib_nh_common *' with an expression of type 'int' [-Wint-conversion]
                   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
                                         ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/core/fib_rules.c:330:27: error: incomplete definition of type 'struct fib6_result'
           struct rt6_info *rt = res->rt6;
                                 ~~~^
   include/net/ipv6_stubs.h:17:8: note: forward declaration of 'struct fib6_result'
   struct fib6_result;
          ^
>> net/core/fib_rules.c:336:8: error: incomplete definition of type 'struct rt6_info'
           if (rt->rt6i_idev)
               ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:337:11: error: incomplete definition of type 'struct rt6_info'
                   dev = rt->rt6i_idev->dev;
                         ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:342:8: error: incomplete definition of type 'struct rt6_info'
           if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
               ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
>> net/core/fib_rules.c:354:2: error: implicit declaration of function 'ip6_rt_put_flags' [-Werror,-Wimplicit-function-declaration]
           ip6_rt_put_flags(rt, flags);
           ^
   1 warning and 6 errors generated.


vim +/fib_info_nhc +300 net/core/fib_rules.c

   291	
   292	static bool fib4_rule_suppress(struct fib_rule *rule,
   293				       int flags,
   294				       struct fib_lookup_arg *arg)
   295	{
   296		struct fib_result *result = (struct fib_result *)arg->result;
   297		struct net_device *dev = NULL;
   298	
   299		if (result->fi) {
 > 300			struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
   301	
   302			dev = nhc->nhc_dev;
   303		}
   304	
   305		/* do not accept result if the route does
   306		 * not meet the required prefix length
   307		 */
   308		if (result->prefixlen <= rule->suppress_prefixlen)
   309			goto suppress_route;
   310	
   311		/* do not accept result if the route uses a device
   312		 * belonging to a forbidden interface group
   313		 */
   314		if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
   315			goto suppress_route;
   316	
   317		return false;
   318	
   319	suppress_route:
   320		if (!(arg->flags & FIB_LOOKUP_NOREF))
   321			fib_info_put(result->fi);
   322		return true;
   323	}
   324	
   325	static bool fib6_rule_suppress(struct fib_rule *rule,
   326				       int flags,
   327				       struct fib_lookup_arg *arg)
   328	{
   329		struct fib6_result *res = arg->result;
 > 330		struct rt6_info *rt = res->rt6;
   331		struct net_device *dev = NULL;
   332	
   333		if (!rt)
   334			return false;
   335	
 > 336		if (rt->rt6i_idev)
   337			dev = rt->rt6i_idev->dev;
   338	
   339		/* do not accept result if the route does
   340		 * not meet the required prefix length
   341		 */
   342		if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
   343			goto suppress_route;
   344	
   345		/* do not accept result if the route uses a device
   346		 * belonging to a forbidden interface group
   347		 */
   348		if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
   349			goto suppress_route;
   350	
   351		return false;
   352	
   353	suppress_route:
 > 354		ip6_rt_put_flags(rt, flags);
   355		return true;
   356	}
   357	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next 1/4] fib: remove suppress indirection
@ 2021-12-13 21:14     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-12-13 21:14 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6023 bytes --]

Hi Florian,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 97884b07122aabb2d6891ce17f54e0e8e94d0bc5
config: hexagon-randconfig-r041-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140528.DqSB8cFq-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/585507534b121a41b45edaec79fe6c3d94a50b5f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florian-Westphal/fib-remove-suppress-indirection-merge-nl-policies/20211213-233429
        git checkout 585507534b121a41b45edaec79fe6c3d94a50b5f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> net/core/fib_rules.c:300:31: error: implicit declaration of function 'fib_info_nhc' [-Werror,-Wimplicit-function-declaration]
                   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
                                               ^
   net/core/fib_rules.c:300:31: note: did you mean 'fib_info_put'?
   include/net/ip_fib.h:574:20: note: 'fib_info_put' declared here
   static inline void fib_info_put(struct fib_info *fi)
                      ^
>> net/core/fib_rules.c:300:25: warning: incompatible integer to pointer conversion initializing 'struct fib_nh_common *' with an expression of type 'int' [-Wint-conversion]
                   struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
                                         ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/core/fib_rules.c:330:27: error: incomplete definition of type 'struct fib6_result'
           struct rt6_info *rt = res->rt6;
                                 ~~~^
   include/net/ipv6_stubs.h:17:8: note: forward declaration of 'struct fib6_result'
   struct fib6_result;
          ^
>> net/core/fib_rules.c:336:8: error: incomplete definition of type 'struct rt6_info'
           if (rt->rt6i_idev)
               ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:337:11: error: incomplete definition of type 'struct rt6_info'
                   dev = rt->rt6i_idev->dev;
                         ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
   net/core/fib_rules.c:342:8: error: incomplete definition of type 'struct rt6_info'
           if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
               ~~^
   include/net/netns/ipv6.h:70:9: note: forward declaration of 'struct rt6_info'
           struct rt6_info         *ip6_null_entry;
                  ^
>> net/core/fib_rules.c:354:2: error: implicit declaration of function 'ip6_rt_put_flags' [-Werror,-Wimplicit-function-declaration]
           ip6_rt_put_flags(rt, flags);
           ^
   1 warning and 6 errors generated.


vim +/fib_info_nhc +300 net/core/fib_rules.c

   291	
   292	static bool fib4_rule_suppress(struct fib_rule *rule,
   293				       int flags,
   294				       struct fib_lookup_arg *arg)
   295	{
   296		struct fib_result *result = (struct fib_result *)arg->result;
   297		struct net_device *dev = NULL;
   298	
   299		if (result->fi) {
 > 300			struct fib_nh_common *nhc = fib_info_nhc(result->fi, 0);
   301	
   302			dev = nhc->nhc_dev;
   303		}
   304	
   305		/* do not accept result if the route does
   306		 * not meet the required prefix length
   307		 */
   308		if (result->prefixlen <= rule->suppress_prefixlen)
   309			goto suppress_route;
   310	
   311		/* do not accept result if the route uses a device
   312		 * belonging to a forbidden interface group
   313		 */
   314		if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
   315			goto suppress_route;
   316	
   317		return false;
   318	
   319	suppress_route:
   320		if (!(arg->flags & FIB_LOOKUP_NOREF))
   321			fib_info_put(result->fi);
   322		return true;
   323	}
   324	
   325	static bool fib6_rule_suppress(struct fib_rule *rule,
   326				       int flags,
   327				       struct fib_lookup_arg *arg)
   328	{
   329		struct fib6_result *res = arg->result;
 > 330		struct rt6_info *rt = res->rt6;
   331		struct net_device *dev = NULL;
   332	
   333		if (!rt)
   334			return false;
   335	
 > 336		if (rt->rt6i_idev)
   337			dev = rt->rt6i_idev->dev;
   338	
   339		/* do not accept result if the route does
   340		 * not meet the required prefix length
   341		 */
   342		if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
   343			goto suppress_route;
   344	
   345		/* do not accept result if the route uses a device
   346		 * belonging to a forbidden interface group
   347		 */
   348		if (rule->suppress_ifgroup != -1 && dev && dev->group == rule->suppress_ifgroup)
   349			goto suppress_route;
   350	
   351		return false;
   352	
   353	suppress_route:
 > 354		ip6_rt_put_flags(rt, flags);
   355		return true;
   356	}
   357	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-12-13 21:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 15:31 [PATCH net-next 0/4] fib: remove suppress indirection, merge nl policies Florian Westphal
2021-12-13 15:31 ` [PATCH net-next 1/4] fib: remove suppress indirection Florian Westphal
2021-12-13 20:39   ` kernel test robot
2021-12-13 20:39     ` kernel test robot
2021-12-13 21:03   ` kernel test robot
2021-12-13 21:03     ` kernel test robot
2021-12-13 21:14   ` kernel test robot
2021-12-13 21:14     ` kernel test robot
2021-12-13 15:31 ` [PATCH net-next 2/4] fib: place common code in a helper Florian Westphal
2021-12-13 15:31 ` [PATCH net-next 3/4] fib: rules: remove duplicated nla policies Florian Westphal
2021-12-13 15:31 ` [PATCH net-next 4/4] fib: expand fib_rule_policy Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.