mirror of https://gitee.com/openkylin/linux.git
net: Verify UDP checksum before handoff to encap
Moving validation of UDP checksum to be done in UDP not encap layer. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
39471ac8dd
commit
0a80966b10
|
@ -1495,6 +1495,10 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
|||
if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) {
|
||||
int ret;
|
||||
|
||||
/* Verify checksum before giving to encap */
|
||||
if (udp_lib_checksum_complete(skb))
|
||||
goto csum_error;
|
||||
|
||||
ret = encap_rcv(sk, skb);
|
||||
if (ret <= 0) {
|
||||
UDP_INC_STATS_BH(sock_net(sk),
|
||||
|
|
|
@ -634,6 +634,10 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
|||
if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) {
|
||||
int ret;
|
||||
|
||||
/* Verify checksum before giving to encap */
|
||||
if (udp_lib_checksum_complete(skb))
|
||||
goto csum_error;
|
||||
|
||||
ret = encap_rcv(sk, skb);
|
||||
if (ret <= 0) {
|
||||
UDP_INC_STATS_BH(sock_net(sk),
|
||||
|
|
Loading…
Reference in New Issue