From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hangbin Liu Subject: [PATCH net] vxlan: use nla_put_flag for ttl inherit Date: Fri, 28 Sep 2018 09:08:26 +0800 Message-ID: <1538096906-20866-1-git-send-email-liuhangbin@gmail.com> Cc: David Miller , Stephen Hemminger , David Ahern , Phil Sutter , Hangbin Liu To: netdev@vger.kernel.org Return-path: Received: from mail-pf1-f194.google.com ([209.85.210.194]:35573 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbeI1H34 (ORCPT ); Fri, 28 Sep 2018 03:29:56 -0400 Received: by mail-pf1-f194.google.com with SMTP id p12-v6so3100729pfh.2 for ; Thu, 27 Sep 2018 18:08:51 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: Phil pointed out that there is a mismatch between vxlan and geneve ttl inherit. We should define it as a flag and use nla_put_flag to export this opiton. Fixes: 8fd780698745b ("vxlan: fill ttl inherit info") Reported-by: Phil Sutter Signed-off-by: Hangbin Liu --- drivers/net/vxlan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 2b8da2b..479dda4 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3539,7 +3539,7 @@ static size_t vxlan_get_size(const struct net_device *dev) nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LINK */ nla_total_size(sizeof(struct in6_addr)) + /* IFLA_VXLAN_LOCAL{6} */ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TTL */ - nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TTL_INHERIT */ + nla_total_size(0) + /* IFLA_VXLAN_TTL_INHERIT */ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TOS */ nla_total_size(sizeof(__be32)) + /* IFLA_VXLAN_LABEL */ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LEARNING */ @@ -3604,8 +3604,6 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev) } if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->cfg.ttl) || - nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT, - !!(vxlan->cfg.flags & VXLAN_F_TTL_INHERIT)) || nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan->cfg.tos) || nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan->cfg.label) || nla_put_u8(skb, IFLA_VXLAN_LEARNING, @@ -3650,6 +3648,10 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev) nla_put_flag(skb, IFLA_VXLAN_REMCSUM_NOPARTIAL)) goto nla_put_failure; + if (vxlan->cfg.flags & VXLAN_F_TTL_INHERIT && + nla_put_flag(skb, IFLA_VXLAN_TTL_INHERIT)) + goto nla_put_failure; + return 0; nla_put_failure: -- 2.5.5