Although the value of AF_INET and NFPROTO_IPV4 is the same, the use of
AF_INET was misleading when checking the proto family.
Same with AF_INET6.

Signed-off-by: Máté Eckl <[email protected]>
---
 src/evaluate.c            | 6 +++---
 src/netlink_delinearize.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 64fcd23..2fe5d1b 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2411,8 +2411,8 @@ static int stmt_evaluate_reject(struct eval_ctx *ctx, 
struct stmt *stmt)
 static int nat_evaluate_family(struct eval_ctx *ctx, struct stmt *stmt)
 {
        switch (ctx->pctx.family) {
-       case AF_INET:
-       case AF_INET6:
+       case NFPROTO_IPV4:
+       case NFPROTO_IPV6:
                return 0;
        default:
                return stmt_error(ctx, stmt,
@@ -2427,7 +2427,7 @@ static int evaluate_addr(struct eval_ctx *ctx, struct 
stmt *stmt,
        const struct datatype *dtype;
        unsigned int len;
 
-       if (pctx->family == AF_INET) {
+       if (pctx->family == NFPROTO_IPV4) {
                dtype = &ipaddr_type;
                len   = 4 * BITS_PER_BYTE;
        } else {
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index 52706b7..387fafe 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -893,7 +893,7 @@ static void netlink_parse_nat(struct netlink_parse_ctx *ctx,
                        goto out_err;
                }
 
-               if (family == AF_INET)
+               if (family == NFPROTO_IPV4)
                        expr_set_type(addr, &ipaddr_type, BYTEORDER_BIG_ENDIAN);
                else
                        expr_set_type(addr, &ip6addr_type,
@@ -910,7 +910,7 @@ static void netlink_parse_nat(struct netlink_parse_ctx *ctx,
                        goto out_err;
                }
 
-               if (family == AF_INET)
+               if (family == NFPROTO_IPV4)
                        expr_set_type(addr, &ipaddr_type, BYTEORDER_BIG_ENDIAN);
                else
                        expr_set_type(addr, &ip6addr_type,
-- 
ecklm

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to