netfilter: nft_fib: convert htonl to ntohl properly
authorLiping Zhang <zlpnobody@gmail.com>
Wed, 23 Nov 2016 14:12:20 +0000 (22:12 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 6 Dec 2016 20:42:20 +0000 (21:42 +0100)
Acctually ntohl and htonl are identical, so this doesn't affect
anything, but it is conceptually wrong.

Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter/nft_fib_ipv4.c
net/ipv6/netfilter/nft_fib_ipv6.c
net/netfilter/nft_fib.c

index 1b49966484b3dec94cb7fc79e94fd085d45e1cb9..bfffa742f397c6cbaec8bca41894afc36b46865d 100644 (file)
@@ -198,7 +198,7 @@ nft_fib4_select_ops(const struct nft_ctx *ctx,
        if (!tb[NFTA_FIB_RESULT])
                return ERR_PTR(-EINVAL);
 
-       result = htonl(nla_get_be32(tb[NFTA_FIB_RESULT]));
+       result = ntohl(nla_get_be32(tb[NFTA_FIB_RESULT]));
 
        switch (result) {
        case NFT_FIB_RESULT_OIF:
index d526bb594956b2a128444e826f65e9729bec88f4..c947aad8bcc620e87cacd942d146cdfb7ad2a73e 100644 (file)
@@ -235,7 +235,7 @@ nft_fib6_select_ops(const struct nft_ctx *ctx,
        if (!tb[NFTA_FIB_RESULT])
                return ERR_PTR(-EINVAL);
 
-       result = htonl(nla_get_be32(tb[NFTA_FIB_RESULT]));
+       result = ntohl(nla_get_be32(tb[NFTA_FIB_RESULT]));
 
        switch (result) {
        case NFT_FIB_RESULT_OIF:
index 249c9b80c1507250f7e944e9bc39e6dc670a0986..29a4906adc277cd3a2cf55242224e4c99fd070e7 100644 (file)
@@ -86,7 +86,7 @@ int nft_fib_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
        if ((priv->flags & (NFTA_FIB_F_SADDR | NFTA_FIB_F_DADDR)) == 0)
                return -EINVAL;
 
-       priv->result = htonl(nla_get_be32(tb[NFTA_FIB_RESULT]));
+       priv->result = ntohl(nla_get_be32(tb[NFTA_FIB_RESULT]));
        priv->dreg = nft_parse_register(tb[NFTA_FIB_DREG]);
 
        switch (priv->result) {