ipvs: Store ipvs not net in struct ip_vs_conn
[deliverable/linux.git] / net / netfilter / ipvs / ip_vs_proto_udp.c
index b62a3c0ff9bf400817b20ec1ea4056586ed5d1dc..3b0a2dc1826b5ff15461c369b128a92577871d30 100644 (file)
@@ -36,17 +36,32 @@ udp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
        struct net *net;
        struct ip_vs_service *svc;
        struct udphdr _udph, *uh;
+       __be16 _ports[2], *ports = NULL;
 
-       /* IPv6 fragments, only first fragment will hit this */
-       uh = skb_header_pointer(skb, iph->len, sizeof(_udph), &_udph);
-       if (uh == NULL) {
+       if (likely(!ip_vs_iph_icmp(iph))) {
+               /* IPv6 fragments, only first fragment will hit this */
+               uh = skb_header_pointer(skb, iph->len, sizeof(_udph), &_udph);
+               if (uh)
+                       ports = &uh->source;
+       } else {
+               ports = skb_header_pointer(
+                       skb, iph->len, sizeof(_ports), &_ports);
+       }
+
+       if (!ports) {
                *verdict = NF_DROP;
                return 0;
        }
+
        net = skb_net(skb);
        rcu_read_lock();
-       svc = ip_vs_service_find(net, af, skb->mark, iph->protocol,
-                                &iph->daddr, uh->dest);
+       if (likely(!ip_vs_iph_inverse(iph)))
+               svc = ip_vs_service_find(net, af, skb->mark, iph->protocol,
+                                        &iph->daddr, ports[1]);
+       else
+               svc = ip_vs_service_find(net, af, skb->mark, iph->protocol,
+                                        &iph->saddr, ports[0]);
+
        if (svc) {
                int ignored;
 
@@ -385,7 +400,7 @@ udp_unregister_app(struct net *net, struct ip_vs_app *inc)
 
 static int udp_app_conn_bind(struct ip_vs_conn *cp)
 {
-       struct netns_ipvs *ipvs = net_ipvs(ip_vs_conn_net(cp));
+       struct netns_ipvs *ipvs = cp->ipvs;
        int hash;
        struct ip_vs_app *inc;
        int result = 0;
This page took 0.02457 seconds and 5 git commands to generate.