cregit-Linux how code gets into the kernel

Release 4.15 net/netfilter/nft_masq.c

Directory: net/netfilter
/*
 * Copyright (c) 2014 Arturo Borrero Gonzalez <arturo@debian.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/netlink.h>
#include <linux/netfilter.h>
#include <linux/netfilter/nf_tables.h>
#include <net/netfilter/nf_tables.h>
#include <net/netfilter/nf_nat.h>
#include <net/netfilter/nft_masq.h>


const struct nla_policy nft_masq_policy[NFTA_MASQ_MAX + 1] = {
	[NFTA_MASQ_FLAGS]		= { .type = NLA_U32 },
	[NFTA_MASQ_REG_PROTO_MIN]	= { .type = NLA_U32 },
	[NFTA_MASQ_REG_PROTO_MAX]	= { .type = NLA_U32 },
};

EXPORT_SYMBOL_GPL(nft_masq_policy);


int nft_masq_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, const struct nft_data **data) { int err; err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); if (err < 0) return err; return nft_chain_validate_hooks(ctx->chain, (1 << NF_INET_POST_ROUTING)); }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso61100.00%1100.00%
Total61100.00%1100.00%

EXPORT_SYMBOL_GPL(nft_masq_validate);
int nft_masq_init(const struct nft_ctx *ctx, const struct nft_expr *expr, const struct nlattr * const tb[]) { u32 plen = FIELD_SIZEOF(struct nf_nat_range, min_addr.all); struct nft_masq *priv = nft_expr_priv(expr); int err; if (tb[NFTA_MASQ_FLAGS]) { priv->flags = ntohl(nla_get_be32(tb[NFTA_MASQ_FLAGS])); if (priv->flags & ~NF_NAT_RANGE_MASK) return -EINVAL; } if (tb[NFTA_MASQ_REG_PROTO_MIN]) { priv->sreg_proto_min = nft_parse_register(tb[NFTA_MASQ_REG_PROTO_MIN]); err = nft_validate_register_load(priv->sreg_proto_min, plen); if (err < 0) return err; if (tb[NFTA_MASQ_REG_PROTO_MAX]) { priv->sreg_proto_max = nft_parse_register(tb[NFTA_MASQ_REG_PROTO_MAX]); err = nft_validate_register_load(priv->sreg_proto_max, plen); if (err < 0) return err; } else { priv->sreg_proto_max = priv->sreg_proto_min; } } return nf_ct_netns_get(ctx->net, ctx->afi->family); }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso11156.92%250.00%
Arturo Borrero Gonzalez7236.92%125.00%
Florian Westphal126.15%125.00%
Total195100.00%4100.00%

EXPORT_SYMBOL_GPL(nft_masq_init);
int nft_masq_dump(struct sk_buff *skb, const struct nft_expr *expr) { const struct nft_masq *priv = nft_expr_priv(expr); if (priv->flags != 0 && nla_put_be32(skb, NFTA_MASQ_FLAGS, htonl(priv->flags))) goto nla_put_failure; if (priv->sreg_proto_min) { if (nft_dump_register(skb, NFTA_MASQ_REG_PROTO_MIN, priv->sreg_proto_min) || nft_dump_register(skb, NFTA_MASQ_REG_PROTO_MAX, priv->sreg_proto_max)) goto nla_put_failure; } return 0; nla_put_failure: return -1; }

Contributors

PersonTokensPropCommitsCommitProp
Arturo Borrero Gonzalez5961.46%150.00%
Pablo Neira Ayuso3738.54%150.00%
Total96100.00%2100.00%

EXPORT_SYMBOL_GPL(nft_masq_dump); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Arturo Borrero Gonzalez <arturo@debian.org>");

Overall Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso23651.87%350.00%
Arturo Borrero Gonzalez20745.49%233.33%
Florian Westphal122.64%116.67%
Total455100.00%6100.00%
Directory: net/netfilter
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.