ipvs: provide address family for debugging
Subsystems (4)
Julian Anastasov
maintainerPATCH 12/12 ipvs: provide address family for debugging
As skb->protocol is not valid in LOCAL_OUT add
parameter for address family in packet debugging functions. Even if ports are not present in AH and ESP change them to use ip_vs_tcpudp_debug_packet to show at least valid addresses as before. This patch removes the last user of skb->protocol in IPVS.
Signed-off-by Julian Anastasov <[email protected]>
---
include/net/ip_vs.h renamed from linux/include/net/ip_vs.h +9 -8
@@ -136,24 +136,24 @@ static inline const char *ip_vs_dbg_addrif (net_ratelimit ()) \ printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \ } while (0) -#define IP_VS_DBG_PKT (level, pp, skb, ofs, msg) \ +#define IP_VS_DBG_PKT (level, af, pp, skb, ofs, msg) \ do { \ if (level <= ip_vs_get_debug_level()) \ - pp->debug_packet(pp, skb, ofs, msg); \ + pp->debug_packet(af, pp, skb, ofs, msg); \ } while (0) -#define IP_VS_DBG_RL_PKT (level, pp, skb, ofs, msg) \ +#define IP_VS_DBG_RL_PKT (level, af, pp, skb, ofs, msg) \ do { \ if (level <= ip_vs_get_debug_level() && \ net_ratelimit()) \ - pp->debug_packet(pp, skb, ofs, msg); \ + pp->debug_packet(af, pp, skb, ofs, msg); \ } while (0)#else /* NO DEBUGGING at ALL */ #define IP_VS_DBG_BUF(level, msg...) do {} while (0) #define IP_VS_ERR_BUF(msg...) do {} while (0) #define IP_VS_DBG(level, msg...) do {} while (0) #define IP_VS_DBG_RL(msg...) do {} while (0) -#define IP_VS_DBG_PKT (level, pp, skb, ofs, msg) do {} while (0) -#define IP_VS_DBG_RL_PKT (level, pp, skb, ofs, msg) do {} while (0) +#define IP_VS_DBG_PKT (level, af, pp, skb, ofs, msg) do {} while (0) +#define IP_VS_DBG_RL_PKT (level, af, pp, skb, ofs, msg) do {} while (0)#endif #define IP_VS_BUG () BUG()
@@ -345,7 +345,7 @@ struct ip_vs_protocol {int (*app_conn_bind)(struct ip_vs_conn *cp); -void (*debug_packet)(struct ip_vs_protocol *pp, +void (*debug_packet)(int af,struct ip_vs_protocol *pp,const struct sk_buff *skb,int offset,const char *msg);
@@ -828,7 +828,8 @@ extern int ip_vs_set_state_timeout(int *table, int num, const char *const *names, const char *name, int to);extern void -ip_vs_tcpudp_debug_packet (struct ip_vs_protocol *pp,const struct sk_buff *skb, +ip_vs_tcpudp_debug_packet (int af,struct ip_vs_protocol *pp, +const struct sk_buff *skb,int offset,const char *msg);extern struct ip_vs_protocol ip_vs_protocol_tcp;
net/netfilter/ipvs/ip_vs_core.c renamed from linux/net/netfilter/ipvs/ip_vs_core.c +24 -17
120 lines not on this page · raw message
net/netfilter/ipvs/ip_vs_proto.c renamed from linux/net/netfilter/ipvs/ip_vs_proto.c +4 -4
@@ -172,8 +172,8 @@ ip_vs_tcpudp_debug_packet_v4(struct ip_velse if (ih->frag_off &htons (IP_OFFSET ))sprintf (buf,"%pI4->%pI4 frag" , &ih->saddr, &ih->daddr);else { -__be16 _ports[2 ], *pptr -; +__be16 _ports[2 ], *pptr; + pptr =skb_header_pointer (skb, offset + ih->ihl*4 ,sizeof (_ports), _ports);if (pptr ==NULL )
@@ -223,13 +223,13 @@ ip_vs_tcpudp_debug_packet_v6(struct ip_vvoid -ip_vs_tcpudp_debug_packet (struct ip_vs_protocol *pp, +ip_vs_tcpudp_debug_packet (int af,struct ip_vs_protocol *pp,const struct sk_buff *skb,int offset,const char *msg) {#ifdef CONFIG_IP_VS_IPV6 -if (skb->protocol ==htons (ETH_P_IPV6 )) +if (af ==AF_INET6 )ip_vs_tcpudp_debug_packet_v6 (pp, skb, offset, msg); else#endif
net/netfilter/ipvs/ip_vs_proto_ah_esp.c renamed from linux/net/netfilter/ipvs/ip_vs_proto_ah_esp.c +2 -50
70 lines not on this page · raw message
net/netfilter/ipvs/ip_vs_proto_sctp.c renamed from linux/net/netfilter/ipvs/ip_vs_proto_sctp.c +1 -1
@@ -176,7 +176,7 @@ sctp_csum_check(int af, struct sk_buff *if (val != cmp) {/* CRC failure, dump it. */ -IP_VS_DBG_RL_PKT (0 , pp, skb,0 , +IP_VS_DBG_RL_PKT (0 , af, pp, skb,0 ,"Failed checksum for" );return 0 ; }
net/netfilter/ipvs/ip_vs_proto_tcp.c renamed from linux/net/netfilter/ipvs/ip_vs_proto_tcp.c +2 -2
@@ -300,7 +300,7 @@ tcp_csum_check(int af, struct sk_buff *s skb->len - tcphoff, ipv6_hdr(skb)->nexthdr, skb->csum)) { -IP_VS_DBG_RL_PKT (0 , pp, skb,0 , +IP_VS_DBG_RL_PKT (0 , af, pp, skb,0 ,"Failed checksum for" );return 0 ; }
@@ -311,7 +311,7 @@ tcp_csum_check(int af, struct sk_buff *s skb->len - tcphoff, ip_hdr(skb)->protocol, skb->csum)) { -IP_VS_DBG_RL_PKT (0 , pp, skb,0 , +IP_VS_DBG_RL_PKT (0 , af, pp, skb,0 ,"Failed checksum for" );return 0 ; }
net/netfilter/ipvs/ip_vs_proto_udp.c renamed from linux/net/netfilter/ipvs/ip_vs_proto_udp.c +2 -2
@@ -314,7 +314,7 @@ udp_csum_check(int af, struct sk_buff *s skb->len - udphoff, ipv6_hdr(skb)->nexthdr, skb->csum)) { -IP_VS_DBG_RL_PKT (0 , pp, skb,0 , +IP_VS_DBG_RL_PKT (0 , af, pp, skb,0 ,"Failed checksum for" );return 0 ; }
@@ -325,7 +325,7 @@ udp_csum_check(int af, struct sk_buff *s skb->len - udphoff, ip_hdr(skb)->protocol, skb->csum)) { -IP_VS_DBG_RL_PKT (0 , pp, skb,0 , +IP_VS_DBG_RL_PKT (0 , af, pp, skb,0 ,"Failed checksum for" );return 0 ; }
net/netfilter/ipvs/ip_vs_xmit.c renamed from linux/net/netfilter/ipvs/ip_vs_xmit.c +10 -8
@@ -542,7 +542,8 @@ ip_vs_nat_xmit(struct sk_buff *skb, strustruct nf_conn *ct = ct =nf_ct_get (skb, &ctinfo);if (ct && !nf_ct_is_untracked (ct)) { -IP_VS_DBG_RL_PKT (10 , pp, skb,0 ,"ip_vs_nat_xmit(): " +IP_VS_DBG_RL_PKT (10 ,AF_INET , pp, skb,0 , +"ip_vs_nat_xmit(): " "stopping DNAT to local address" ); goto tx_error_put; }
@@ -551,7 +552,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, stru/* From world but DNAT to loopback address? */ if (local &&ipv4_is_loopback (rt->rt_dst) &&skb_rtable (skb)->fl.iif) { -IP_VS_DBG_RL_PKT (1 , pp, skb,0 ,"ip_vs_nat_xmit(): " +IP_VS_DBG_RL_PKT (1 ,AF_INET , pp, skb,0 ,"ip_vs_nat_xmit(): " "stopping DNAT to loopback address" ); goto tx_error_put; }
@@ -560,7 +561,8 @@ ip_vs_nat_xmit(struct sk_buff *skb, stru mtu =dst_mtu (&rt->dst);if ((skb->len > mtu) && (iph->frag_off &htons (IP_DF ))) {icmp_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu)); -IP_VS_DBG_RL_PKT (0 , pp, skb,0 ,"ip_vs_nat_xmit(): frag needed for" ); +IP_VS_DBG_RL_PKT (0 ,AF_INET , pp, skb,0 , +"ip_vs_nat_xmit(): frag needed for" ); goto tx_error_put; }
@@ -592,7 +594,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, stru goto tx_error; } -IP_VS_DBG_PKT (10 , pp, skb,0 ,"After DNAT" ); +IP_VS_DBG_PKT (10 ,AF_INET , pp, skb,0 ,"After DNAT" );/* FIXME: when application helper enlarges the packet and the length is larger than the MTU of outgoing device, there will be still
@@ -653,7 +655,7 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, sstruct nf_conn *ct = ct =nf_ct_get (skb, &ctinfo);if (ct && !nf_ct_is_untracked (ct)) { -IP_VS_DBG_RL_PKT (10 , pp, skb,0 , +IP_VS_DBG_RL_PKT (10 ,AF_INET6 , pp, skb,0 ,"ip_vs_nat_xmit_v6(): " "stopping DNAT to local address" ); goto tx_error_put;
@@ -664,7 +666,7 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, s/* From world but DNAT to loopback address? */ if (local && skb->dev && !(skb->dev->flags &IFF_LOOPBACK ) &&ipv6_addr_type (&rt->rt6i_dst.addr) &IPV6_ADDR_LOOPBACK ) { -IP_VS_DBG_RL_PKT (1 , pp, skb,0 , +IP_VS_DBG_RL_PKT (1 ,AF_INET6 , pp, skb,0 ,"ip_vs_nat_xmit_v6(): " "stopping DNAT to loopback address" ); goto tx_error_put;
@@ -679,7 +681,7 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, s skb->dev = net->loopback_dev; }icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); -IP_VS_DBG_RL_PKT (0 , pp, skb,0 , +IP_VS_DBG_RL_PKT (0 ,AF_INET6 , pp, skb,0 ,"ip_vs_nat_xmit_v6(): frag needed for" ); goto tx_error_put; }
@@ -705,7 +707,7 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, sdst_release (&rt->dst); } -IP_VS_DBG_PKT (10 , pp, skb,0 ,"After DNAT" ); +IP_VS_DBG_PKT (10 ,AF_INET6 , pp, skb,0 ,"After DNAT" );/* FIXME: when application helper enlarges the packet and the length is larger than the MTU of outgoing device, there will be still