]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
netfilter: nft_tunnel: no need to call htons() when dumping ports
authorXin Long <lucien.xin@gmail.com>
Fri, 13 Dec 2019 08:53:05 +0000 (16:53 +0800)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 6 Mar 2020 13:06:00 +0000 (14:06 +0100)
BugLink: https://bugs.launchpad.net/bugs/1866333
commit cf3e204a1ca5442190018a317d9ec181b4639bd6 upstream.

info->key.tp_src and tp_dst are __be16, when using nla_put_be16()
to dump them, htons() is not needed, so remove it in this patch.

Fixes: af308b94a2a4 ("netfilter: nf_tables: add tunnel support")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
net/netfilter/nft_tunnel.c

index f8d2919cf9fdccfbd525d35e5ccef8abb6ce4f49..037e8fce9b30e4a90b854068d0b800fefb3d0f59 100644 (file)
@@ -505,8 +505,8 @@ static int nft_tunnel_opts_dump(struct sk_buff *skb,
 static int nft_tunnel_ports_dump(struct sk_buff *skb,
                                 struct ip_tunnel_info *info)
 {
-       if (nla_put_be16(skb, NFTA_TUNNEL_KEY_SPORT, htons(info->key.tp_src)) < 0 ||
-           nla_put_be16(skb, NFTA_TUNNEL_KEY_DPORT, htons(info->key.tp_dst)) < 0)
+       if (nla_put_be16(skb, NFTA_TUNNEL_KEY_SPORT, info->key.tp_src) < 0 ||
+           nla_put_be16(skb, NFTA_TUNNEL_KEY_DPORT, info->key.tp_dst) < 0)
                return -1;
 
        return 0;