netfilter: conntrack: remove pkt_to_tuple callback
GRE is now builtin, so we can handle it via direct call and remove the callback. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
751fc301ec
commit
df5e162908
5 changed files with 8 additions and 21 deletions
|
@ -30,5 +30,7 @@ void nf_ct_gre_keymap_flush(struct net *net);
|
||||||
/* delete keymap entries */
|
/* delete keymap entries */
|
||||||
void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
|
void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
|
||||||
|
|
||||||
|
bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff,
|
||||||
|
struct net *net, struct nf_conntrack_tuple *tuple);
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
#endif /* _CONNTRACK_PROTO_GRE_H */
|
#endif /* _CONNTRACK_PROTO_GRE_H */
|
||||||
|
|
|
@ -27,11 +27,6 @@ struct nf_conntrack_l4proto {
|
||||||
/* protoinfo nlattr size, closes a hole */
|
/* protoinfo nlattr size, closes a hole */
|
||||||
u16 nlattr_size;
|
u16 nlattr_size;
|
||||||
|
|
||||||
/* Try to fill in the third arg: dataoff is offset past network protocol
|
|
||||||
hdr. Return true if possible. */
|
|
||||||
bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int dataoff,
|
|
||||||
struct net *net, struct nf_conntrack_tuple *tuple);
|
|
||||||
|
|
||||||
/* Invert the per-proto part of the tuple: ie. turn xmit into reply.
|
/* Invert the per-proto part of the tuple: ie. turn xmit into reply.
|
||||||
* Only used by icmp, most protocols use a generic version.
|
* Only used by icmp, most protocols use a generic version.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -279,9 +279,11 @@ nf_ct_get_tuple(const struct sk_buff *skb,
|
||||||
return icmpv6_pkt_to_tuple(skb, dataoff, net, tuple);
|
return icmpv6_pkt_to_tuple(skb, dataoff, net, tuple);
|
||||||
case IPPROTO_ICMP:
|
case IPPROTO_ICMP:
|
||||||
return icmp_pkt_to_tuple(skb, dataoff, net, tuple);
|
return icmp_pkt_to_tuple(skb, dataoff, net, tuple);
|
||||||
|
#ifdef CONFIG_NF_CT_PROTO_GRE
|
||||||
|
case IPPROTO_GRE:
|
||||||
|
return gre_pkt_to_tuple(skb, dataoff, net, tuple);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (unlikely(l4proto->pkt_to_tuple))
|
|
||||||
return l4proto->pkt_to_tuple(skb, dataoff, net, tuple);
|
|
||||||
|
|
||||||
/* Actually only need first 4 bytes to get ports. */
|
/* Actually only need first 4 bytes to get ports. */
|
||||||
inet_hdr = skb_header_pointer(skb, dataoff, sizeof(_inet_hdr), &_inet_hdr);
|
inet_hdr = skb_header_pointer(skb, dataoff, sizeof(_inet_hdr), &_inet_hdr);
|
||||||
|
|
|
@ -27,16 +27,6 @@ static bool nf_generic_should_process(u8 proto)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool generic_pkt_to_tuple(const struct sk_buff *skb,
|
|
||||||
unsigned int dataoff,
|
|
||||||
struct net *net, struct nf_conntrack_tuple *tuple)
|
|
||||||
{
|
|
||||||
tuple->src.u.all = 0;
|
|
||||||
tuple->dst.u.all = 0;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns verdict for packet, or -1 for invalid. */
|
/* Returns verdict for packet, or -1 for invalid. */
|
||||||
static int generic_packet(struct nf_conn *ct,
|
static int generic_packet(struct nf_conn *ct,
|
||||||
struct sk_buff *skb,
|
struct sk_buff *skb,
|
||||||
|
@ -149,7 +139,6 @@ static struct nf_proto_net *generic_get_net_proto(struct net *net)
|
||||||
const struct nf_conntrack_l4proto nf_conntrack_l4proto_generic =
|
const struct nf_conntrack_l4proto nf_conntrack_l4proto_generic =
|
||||||
{
|
{
|
||||||
.l4proto = 255,
|
.l4proto = 255,
|
||||||
.pkt_to_tuple = generic_pkt_to_tuple,
|
|
||||||
.packet = generic_packet,
|
.packet = generic_packet,
|
||||||
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
|
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
|
||||||
.ctnl_timeout = {
|
.ctnl_timeout = {
|
||||||
|
|
|
@ -162,8 +162,8 @@ EXPORT_SYMBOL_GPL(nf_ct_gre_keymap_destroy);
|
||||||
/* PUBLIC CONNTRACK PROTO HELPER FUNCTIONS */
|
/* PUBLIC CONNTRACK PROTO HELPER FUNCTIONS */
|
||||||
|
|
||||||
/* gre hdr info to tuple */
|
/* gre hdr info to tuple */
|
||||||
static bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff,
|
bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff,
|
||||||
struct net *net, struct nf_conntrack_tuple *tuple)
|
struct net *net, struct nf_conntrack_tuple *tuple)
|
||||||
{
|
{
|
||||||
const struct pptp_gre_header *pgrehdr;
|
const struct pptp_gre_header *pgrehdr;
|
||||||
struct pptp_gre_header _pgrehdr;
|
struct pptp_gre_header _pgrehdr;
|
||||||
|
@ -368,7 +368,6 @@ static int gre_init_net(struct net *net)
|
||||||
/* protocol helper struct */
|
/* protocol helper struct */
|
||||||
const struct nf_conntrack_l4proto nf_conntrack_l4proto_gre = {
|
const struct nf_conntrack_l4proto nf_conntrack_l4proto_gre = {
|
||||||
.l4proto = IPPROTO_GRE,
|
.l4proto = IPPROTO_GRE,
|
||||||
.pkt_to_tuple = gre_pkt_to_tuple,
|
|
||||||
#ifdef CONFIG_NF_CONNTRACK_PROCFS
|
#ifdef CONFIG_NF_CONNTRACK_PROCFS
|
||||||
.print_conntrack = gre_print_conntrack,
|
.print_conntrack = gre_print_conntrack,
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue