diff options
| -rw-r--r-- | net/netfilter/nft_log.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/net/netfilter/nft_log.c b/net/netfilter/nft_log.c index 10cfb156cdf4..55d4297d8417 100644 --- a/net/netfilter/nft_log.c +++ b/net/netfilter/nft_log.c | |||
| @@ -50,6 +50,7 @@ static int nft_log_init(const struct nft_ctx *ctx, | |||
| 50 | struct nft_log *priv = nft_expr_priv(expr); | 50 | struct nft_log *priv = nft_expr_priv(expr); |
| 51 | struct nf_loginfo *li = &priv->loginfo; | 51 | struct nf_loginfo *li = &priv->loginfo; |
| 52 | const struct nlattr *nla; | 52 | const struct nlattr *nla; |
| 53 | int ret; | ||
| 53 | 54 | ||
| 54 | nla = tb[NFTA_LOG_PREFIX]; | 55 | nla = tb[NFTA_LOG_PREFIX]; |
| 55 | if (nla != NULL) { | 56 | if (nla != NULL) { |
| @@ -71,16 +72,37 @@ static int nft_log_init(const struct nft_ctx *ctx, | |||
| 71 | ntohs(nla_get_be16(tb[NFTA_LOG_QTHRESHOLD])); | 72 | ntohs(nla_get_be16(tb[NFTA_LOG_QTHRESHOLD])); |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | return 0; | 75 | if (ctx->afi->family == NFPROTO_INET) { |
| 76 | ret = nf_logger_find_get(NFPROTO_IPV4, li->type); | ||
| 77 | if (ret < 0) | ||
| 78 | return ret; | ||
| 79 | |||
| 80 | ret = nf_logger_find_get(NFPROTO_IPV6, li->type); | ||
| 81 | if (ret < 0) { | ||
| 82 | nf_logger_put(NFPROTO_IPV4, li->type); | ||
| 83 | return ret; | ||
| 84 | } | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | return nf_logger_find_get(ctx->afi->family, li->type); | ||
| 75 | } | 89 | } |
| 76 | 90 | ||
| 77 | static void nft_log_destroy(const struct nft_ctx *ctx, | 91 | static void nft_log_destroy(const struct nft_ctx *ctx, |
| 78 | const struct nft_expr *expr) | 92 | const struct nft_expr *expr) |
| 79 | { | 93 | { |
| 80 | struct nft_log *priv = nft_expr_priv(expr); | 94 | struct nft_log *priv = nft_expr_priv(expr); |
| 95 | struct nf_loginfo *li = &priv->loginfo; | ||
| 81 | 96 | ||
| 82 | if (priv->prefix != nft_log_null_prefix) | 97 | if (priv->prefix != nft_log_null_prefix) |
| 83 | kfree(priv->prefix); | 98 | kfree(priv->prefix); |
| 99 | |||
| 100 | if (ctx->afi->family == NFPROTO_INET) { | ||
| 101 | nf_logger_put(NFPROTO_IPV4, li->type); | ||
| 102 | nf_logger_put(NFPROTO_IPV6, li->type); | ||
| 103 | } else { | ||
| 104 | nf_logger_put(ctx->afi->family, li->type); | ||
| 105 | } | ||
| 84 | } | 106 | } |
| 85 | 107 | ||
| 86 | static int nft_log_dump(struct sk_buff *skb, const struct nft_expr *expr) | 108 | static int nft_log_dump(struct sk_buff *skb, const struct nft_expr *expr) |
