aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/netpoll.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/netpoll.c')
-rw-r--r--net/core/netpoll.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index fc75c9e461b8..8f971990677c 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -636,8 +636,9 @@ static void netpoll_neigh_reply(struct sk_buff *skb, struct netpoll_info *npinfo
636 636
637 netpoll_send_skb(np, send_skb); 637 netpoll_send_skb(np, send_skb);
638 638
639 /* If there are several rx_hooks for the same address, 639 /* If there are several rx_skb_hooks for the same
640 we're fine by sending a single reply */ 640 * address we're fine by sending a single reply
641 */
641 break; 642 break;
642 } 643 }
643 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 644 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
@@ -719,8 +720,9 @@ static void netpoll_neigh_reply(struct sk_buff *skb, struct netpoll_info *npinfo
719 720
720 netpoll_send_skb(np, send_skb); 721 netpoll_send_skb(np, send_skb);
721 722
722 /* If there are several rx_hooks for the same address, 723 /* If there are several rx_skb_hooks for the same
723 we're fine by sending a single reply */ 724 * address, we're fine by sending a single reply
725 */
724 break; 726 break;
725 } 727 }
726 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 728 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
@@ -756,11 +758,12 @@ static bool pkt_is_ns(struct sk_buff *skb)
756 758
757int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo) 759int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
758{ 760{
759 int proto, len, ulen; 761 int proto, len, ulen, data_len;
760 int hits = 0; 762 int hits = 0, offset;
761 const struct iphdr *iph; 763 const struct iphdr *iph;
762 struct udphdr *uh; 764 struct udphdr *uh;
763 struct netpoll *np, *tmp; 765 struct netpoll *np, *tmp;
766 uint16_t source;
764 767
765 if (list_empty(&npinfo->rx_np)) 768 if (list_empty(&npinfo->rx_np))
766 goto out; 769 goto out;
@@ -820,7 +823,10 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
820 823
821 len -= iph->ihl*4; 824 len -= iph->ihl*4;
822 uh = (struct udphdr *)(((char *)iph) + iph->ihl*4); 825 uh = (struct udphdr *)(((char *)iph) + iph->ihl*4);
826 offset = (unsigned char *)(uh + 1) - skb->data;
823 ulen = ntohs(uh->len); 827 ulen = ntohs(uh->len);
828 data_len = skb->len - offset;
829 source = ntohs(uh->source);
824 830
825 if (ulen != len) 831 if (ulen != len)
826 goto out; 832 goto out;
@@ -834,9 +840,7 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
834 if (np->local_port && np->local_port != ntohs(uh->dest)) 840 if (np->local_port && np->local_port != ntohs(uh->dest))
835 continue; 841 continue;
836 842
837 np->rx_hook(np, ntohs(uh->source), 843 np->rx_skb_hook(np, source, skb, offset, data_len);
838 (char *)(uh+1),
839 ulen - sizeof(struct udphdr));
840 hits++; 844 hits++;
841 } 845 }
842 } else { 846 } else {
@@ -859,7 +863,10 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
859 if (!pskb_may_pull(skb, sizeof(struct udphdr))) 863 if (!pskb_may_pull(skb, sizeof(struct udphdr)))
860 goto out; 864 goto out;
861 uh = udp_hdr(skb); 865 uh = udp_hdr(skb);
866 offset = (unsigned char *)(uh + 1) - skb->data;
862 ulen = ntohs(uh->len); 867 ulen = ntohs(uh->len);
868 data_len = skb->len - offset;
869 source = ntohs(uh->source);
863 if (ulen != skb->len) 870 if (ulen != skb->len)
864 goto out; 871 goto out;
865 if (udp6_csum_init(skb, uh, IPPROTO_UDP)) 872 if (udp6_csum_init(skb, uh, IPPROTO_UDP))
@@ -872,9 +879,7 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
872 if (np->local_port && np->local_port != ntohs(uh->dest)) 879 if (np->local_port && np->local_port != ntohs(uh->dest))
873 continue; 880 continue;
874 881
875 np->rx_hook(np, ntohs(uh->source), 882 np->rx_skb_hook(np, source, skb, offset, data_len);
876 (char *)(uh+1),
877 ulen - sizeof(struct udphdr));
878 hits++; 883 hits++;
879 } 884 }
880#endif 885#endif
@@ -1062,7 +1067,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp)
1062 1067
1063 npinfo->netpoll = np; 1068 npinfo->netpoll = np;
1064 1069
1065 if (np->rx_hook) { 1070 if (np->rx_skb_hook) {
1066 spin_lock_irqsave(&npinfo->rx_lock, flags); 1071 spin_lock_irqsave(&npinfo->rx_lock, flags);
1067 npinfo->rx_flags |= NETPOLL_RX_ENABLED; 1072 npinfo->rx_flags |= NETPOLL_RX_ENABLED;
1068 list_add_tail(&np->rx, &npinfo->rx_np); 1073 list_add_tail(&np->rx, &npinfo->rx_np);