Signed-off-by: Máté Eckl <[email protected]>
---
 src/evaluate.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index d6aff61..0564b44 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2431,12 +2431,28 @@ static int evaluate_addr(struct eval_ctx *ctx, struct 
stmt *stmt,
        const struct datatype *dtype;
        unsigned int len;
 
-       if (pctx->family == NFPROTO_IPV4) {
+       switch (pctx->family) {
+       case NFPROTO_IPV4:
                dtype = &ipaddr_type;
                len   = 4 * BITS_PER_BYTE;
-       } else {
+               break;
+       case NFPROTO_IPV6:
                dtype = &ip6addr_type;
                len   = 16 * BITS_PER_BYTE;
+               break;
+       case NFPROTO_INET:
+               if (strchr((*expr)->identifier, ':')) {
+                       dtype = &ip6addr_type;
+                       len   = 16 * BITS_PER_BYTE;
+               }
+               else {
+                       dtype = &ipaddr_type;
+                       len   = 4 * BITS_PER_BYTE;
+               }
+               break;
+       default:
+               return stmt_binary_error(ctx, *expr, stmt,
+                                        "Invalid context family for address 
evaluation");
        }
 
        return stmt_evaluate_arg(ctx, stmt, dtype, len, BYTEORDER_BIG_ENDIAN,
-- 
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