Commit 9bbc768a authored by Jan Engelhardt's avatar Jan Engelhardt

netfilter: ipv4: use NFPROTO values for NF_HOOK invocation

The semantic patch that was used:
// <smpl>
@@
@@
(NF_HOOK
|NF_HOOK_COND
|nf_hook
)(
-PF_INET,
+NFPROTO_IPV4,
 ...)
// </smpl>
Signed-off-by: default avatarJan Engelhardt <jengelh@medozas.de>
parent 713aefa3
...@@ -111,8 +111,8 @@ int ip_forward(struct sk_buff *skb) ...@@ -111,8 +111,8 @@ int ip_forward(struct sk_buff *skb)
skb->priority = rt_tos2priority(iph->tos); skb->priority = rt_tos2priority(iph->tos);
return NF_HOOK(PF_INET, NF_INET_FORWARD, skb, skb->dev, rt->u.dst.dev, return NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD, skb, skb->dev,
ip_forward_finish); rt->u.dst.dev, ip_forward_finish);
sr_failed: sr_failed:
/* /*
......
...@@ -265,7 +265,7 @@ int ip_local_deliver(struct sk_buff *skb) ...@@ -265,7 +265,7 @@ int ip_local_deliver(struct sk_buff *skb)
return 0; return 0;
} }
return NF_HOOK(PF_INET, NF_INET_LOCAL_IN, skb, skb->dev, NULL, return NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_IN, skb, skb->dev, NULL,
ip_local_deliver_finish); ip_local_deliver_finish);
} }
...@@ -443,7 +443,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, ...@@ -443,7 +443,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
/* Must drop socket now because of tproxy. */ /* Must drop socket now because of tproxy. */
skb_orphan(skb); skb_orphan(skb);
return NF_HOOK(PF_INET, NF_INET_PRE_ROUTING, skb, dev, NULL, return NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, skb, dev, NULL,
ip_rcv_finish); ip_rcv_finish);
inhdr_error: inhdr_error:
......
...@@ -95,8 +95,8 @@ int __ip_local_out(struct sk_buff *skb) ...@@ -95,8 +95,8 @@ int __ip_local_out(struct sk_buff *skb)
iph->tot_len = htons(skb->len); iph->tot_len = htons(skb->len);
ip_send_check(iph); ip_send_check(iph);
return nf_hook(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, skb_dst(skb)->dev, return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, skb, NULL,
dst_output); skb_dst(skb)->dev, dst_output);
} }
int ip_local_out(struct sk_buff *skb) int ip_local_out(struct sk_buff *skb)
...@@ -271,8 +271,8 @@ int ip_mc_output(struct sk_buff *skb) ...@@ -271,8 +271,8 @@ int ip_mc_output(struct sk_buff *skb)
) { ) {
struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
if (newskb) if (newskb)
NF_HOOK(PF_INET, NF_INET_POST_ROUTING, newskb, NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING,
NULL, newskb->dev, newskb, NULL, newskb->dev,
ip_dev_loopback_xmit); ip_dev_loopback_xmit);
} }
...@@ -287,12 +287,12 @@ int ip_mc_output(struct sk_buff *skb) ...@@ -287,12 +287,12 @@ int ip_mc_output(struct sk_buff *skb)
if (rt->rt_flags&RTCF_BROADCAST) { if (rt->rt_flags&RTCF_BROADCAST) {
struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
if (newskb) if (newskb)
NF_HOOK(PF_INET, NF_INET_POST_ROUTING, newskb, NULL, NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, newskb,
newskb->dev, ip_dev_loopback_xmit); NULL, newskb->dev, ip_dev_loopback_xmit);
} }
return NF_HOOK_COND(PF_INET, NF_INET_POST_ROUTING, skb, NULL, skb->dev, return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, skb, NULL,
ip_finish_output, skb->dev, ip_finish_output,
!(IPCB(skb)->flags & IPSKB_REROUTED)); !(IPCB(skb)->flags & IPSKB_REROUTED));
} }
...@@ -305,7 +305,7 @@ int ip_output(struct sk_buff *skb) ...@@ -305,7 +305,7 @@ int ip_output(struct sk_buff *skb)
skb->dev = dev; skb->dev = dev;
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
return NF_HOOK_COND(PF_INET, NF_INET_POST_ROUTING, skb, NULL, dev, return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, skb, NULL, dev,
ip_finish_output, ip_finish_output,
!(IPCB(skb)->flags & IPSKB_REROUTED)); !(IPCB(skb)->flags & IPSKB_REROUTED));
} }
......
...@@ -1319,7 +1319,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) ...@@ -1319,7 +1319,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
* not mrouter) cannot join to more than one interface - it will * not mrouter) cannot join to more than one interface - it will
* result in receiving multiple packets. * result in receiving multiple packets.
*/ */
NF_HOOK(PF_INET, NF_INET_FORWARD, skb, skb->dev, dev, NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD, skb, skb->dev, dev,
ipmr_forward_finish); ipmr_forward_finish);
return; return;
......
...@@ -382,8 +382,8 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, ...@@ -382,8 +382,8 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
icmp_out_count(net, ((struct icmphdr *) icmp_out_count(net, ((struct icmphdr *)
skb_transport_header(skb))->type); skb_transport_header(skb))->type);
err = NF_HOOK(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, skb, NULL,
dst_output); rt->u.dst.dev, dst_output);
if (err > 0) if (err > 0)
err = net_xmit_errno(err); err = net_xmit_errno(err);
if (err) if (err)
......
...@@ -60,7 +60,7 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async) ...@@ -60,7 +60,7 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async)
iph->tot_len = htons(skb->len); iph->tot_len = htons(skb->len);
ip_send_check(iph); ip_send_check(iph);
NF_HOOK(PF_INET, NF_INET_PRE_ROUTING, skb, skb->dev, NULL, NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, skb, skb->dev, NULL,
xfrm4_rcv_encap_finish); xfrm4_rcv_encap_finish);
return 0; return 0;
} }
......
...@@ -86,7 +86,7 @@ static int xfrm4_output_finish(struct sk_buff *skb) ...@@ -86,7 +86,7 @@ static int xfrm4_output_finish(struct sk_buff *skb)
int xfrm4_output(struct sk_buff *skb) int xfrm4_output(struct sk_buff *skb)
{ {
return NF_HOOK_COND(PF_INET, NF_INET_POST_ROUTING, skb, return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, skb,
NULL, skb_dst(skb)->dev, xfrm4_output_finish, NULL, skb_dst(skb)->dev, xfrm4_output_finish,
!(IPCB(skb)->flags & IPSKB_REROUTED)); !(IPCB(skb)->flags & IPSKB_REROUTED));
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment