Un-define the IPTUNNEL_XMIT() macro
Subsystems (3)
PATCH 1/4 Un-define the IPTUNNEL_XMIT() macro
This one is used in all the smth-to-ip tunnels we have and looks ... not very good. Make this a regular function in the tunnel4.ko module.
Signed-off-by Pavel Emelyanov <[email protected]>
---
include/net/ipip.h +2 -18
@@ -25,23 +25,7 @@ struct ip_tunnel struct ip_tunnel_parm parms; }; -#define IPTUNNEL_XMIT () do { \ - int err; \ - int pkt_len = skb->len; \ - \ - skb->ip_summed = CHECKSUM_NONE; \ - iph->tot_len = htons(skb->len); \ - ip_select_ident(iph, &rt->u.dst, NULL); \ - ip_send_check(iph); \ - \ - err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output);\ - if (net_xmit_eval(err) == 0) { \ - stats->tx_bytes += pkt_len; \ - stats->tx_packets++; \ - } else { \ - stats->tx_errors++; \ - stats->tx_aborted_errors++; \ - } \ -} while (0) +void iptunnel_xmit (struct sk_buff *skb,struct rtable *rt, +struct net_device_stats *stats);#endif
net/ipv4/ip_gre.c +1 -1
@@ -882,7 +882,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)nf_reset (skb); -IPTUNNEL_XMIT (); +iptunnel_xmit (skb, rt, stats); tunnel->recursion--;return 0 ;
net/ipv4/ipip.c +1 -1
@@ -638,7 +638,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)nf_reset (skb); -IPTUNNEL_XMIT (); +iptunnel_xmit (skb, rt, stats); tunnel->recursion--;return 0 ;
net/ipv4/tunnel4.c +27 -0
@@ -8,6 +8,7 @@#include <linux/mutex.h> #include <linux/netdevice.h> #include <linux/skbuff.h> +#include <linux/netfilter_ipv4.h> #include <net/icmp.h> #include <net/ip.h> #include <net/protocol.h>
@@ -71,6 +72,32 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family)EXPORT_SYMBOL (xfrm4_tunnel_deregister); +void iptunnel_xmit (struct sk_buff *skb,struct rtable *rt, +struct net_device_stats *stats) +{ +int err; +struct iphdr *iph =ip_hdr (skb); +int pkt_len = skb->len; + + skb->ip_summed =CHECKSUM_NONE ; + iph->tot_len =htons (skb->len); +ip_select_ident (iph, &rt->u.dst,NULL ); +ip_send_check (iph); + + err =NF_HOOK (PF_INET ,NF_IP_LOCAL_OUT , skb,NULL , + rt->u.dst.dev, dst_output); + +if (net_xmit_eval (err) ==0 ) { + stats->tx_bytes += pkt_len; + stats->tx_packets++; + }else { + stats->tx_errors++; + stats->tx_aborted_errors++; + } +} + +EXPORT_SYMBOL (iptunnel_xmit); +static int tunnel4_rcv (struct sk_buff *skb) {struct xfrm_tunnel *handler;
net/ipv6/sit.c +1 -1
@@ -579,7 +579,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)nf_reset (skb); -IPTUNNEL_XMIT (); +iptunnel_xmit (skb, rt, stats); tunnel->recursion--;return 0 ;
Signature · 1 line
1.5.3.4
David Miller
maintainerFrom: Pavel Emelyanov <[email protected]>
Date: Fri, 09 Nov 2007 16:09:58 +0300
Quoted 5 lines
This one is used in all the smth-to-ip tunnels we have and looks ... not very good. Make this a regular function in the tunnel4.ko module.
Signed-off-by Pavel Emelyanov <[email protected]>
This breaks the build if NET_IPGRE is selected, and I don't think it's wise to add the dependency on INET_TUNNEL just for this one function.