diff options
Diffstat (limited to 'net/ipv6/fib6_rules.c')
| -rw-r--r-- | net/ipv6/fib6_rules.c | 18 | 
1 files changed, 8 insertions, 10 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index b6c57315206..0ff1cfd55bc 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -22,8 +22,7 @@  #include <net/ip6_route.h>  #include <net/netlink.h> -struct fib6_rule -{ +struct fib6_rule {  	struct fib_rule		common;  	struct rt6key		src;  	struct rt6key		dst; @@ -215,14 +214,13 @@ static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb,  	frh->src_len = rule6->src.plen;  	frh->tos = rule6->tclass; -	if (rule6->dst.plen) -		NLA_PUT(skb, FRA_DST, sizeof(struct in6_addr), -			&rule6->dst.addr); - -	if (rule6->src.plen) -		NLA_PUT(skb, FRA_SRC, sizeof(struct in6_addr), -			&rule6->src.addr); - +	if ((rule6->dst.plen && +	     nla_put(skb, FRA_DST, sizeof(struct in6_addr), +		     &rule6->dst.addr)) || +	    (rule6->src.plen && +	     nla_put(skb, FRA_SRC, sizeof(struct in6_addr), +		     &rule6->src.addr))) +		goto nla_put_failure;  	return 0;  nla_put_failure:  |