nsh: set mac len based on inner packet
Subsystems (4)
Willem de Bruijn
maintainerPATCH 1/1 nsh: set mac len based on inner packet
From: Willem de Bruijn <[email protected]>
When pulling the NSH header in nsh_gso_segment, set the mac length based on the encapsulated packet type.
skb_reset_mac_len computes an offset to the network header, which here still points to the outer packet:
Quoted 7 lines
skb_reset_network_header(skb);
[...]
__skb_pull(skb, nsh_len);
skb_reset_mac_header(skb); // now mac hdr starts nsh_len == 8B after net hdr
skb_reset_mac_len(skb); // mac len = net hdr - mac hdr == (u16) -8 == 65528
[..]
skb_mac_gso_segment(skb, ..)--- net/nsh/nsh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/nsh/nsh.c +1 -1
@@ -104,7 +104,7 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,__skb_pull (skb, nsh_len);skb_reset_mac_header (skb); -skb_reset_mac_len (skb); + skb->mac_len = proto ==htons (ETH_P_TEB ) ?ETH_HLEN :0 ; skb->protocol = proto; features &=NETIF_F_SG ;
Signature · 1 line
2.18.0.203.gfac676dfb9-goog
Willem de Bruijn
maintainerPATCH 1/1 packet: reset network header if packet shorter than ll reserved space
From: Willem de Bruijn <[email protected]>
If variable length link layer headers result in a packet shorter than dev->hard_header_len, reset the network header offset. Else skb->mac_len may exceed skb->len after skb_mac_reset_len.
packet_sendmsg_spkt already has similar logic.
--- net/packet/af_packet.c | 2 ++ 1 file changed, 2 insertions(+)
net/packet/af_packet.c +2 -0
@@ -2878,6 +2878,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) goto out_free; }else if (reserve) {skb_reserve (skb, -reserve); +if (len < reserve) +skb_reset_network_header (skb); }/* Returns -EFAULT on error */
Signature · 1 line
2.18.0.203.gfac676dfb9-goog
Willem de Bruijn
maintainerPATCH 1/1 selftests: in udpgso_bench do not test udp zerocopy
In reply to Willem de BruijnFrom: Willem de Bruijn <[email protected]>
The udpgso benchmark compares various configurations of UDP and TCP. Including one that is not upstream, udp zerocopy. This is a leftover from the earlier RFC patchset.
The test is part of kselftests and run in continuous spinners. Remove the failing case to make the test start passing.
--- tools/testing/selftests/net/udpgso_bench.sh | 3 --- 1 file changed, 3 deletions(-)
tools/testing/selftests/net/udpgso_bench.sh +0 -3
@@ -35,9 +35,6 @@ run_udp() { echo "udp gso" run_in_netns ${args} -S - - echo "udp gso zerocopy" - run_in_netns ${args} -S -z } run_tcp() {
Signature · 1 line
2.18.0.203.gfac676dfb9-goog
Quoted 16 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
When pulling the NSH header in
nsh_gso_segment, set the mac length based on the encapsulated packet type.
skb_reset_mac_lencomputes an offset to the network header, which here still points to the outer packet:Quoted 7 lines
skb_reset_network_header(skb); [...] __skb_pull(skb, nsh_len); skb_reset_mac_header(skb); // now mac hdr starts nsh_len == 8B after net hdr skb_reset_mac_len(skb); // mac len = net hdr - mac hdr == (u16) -8 == 65528 [..] skb_mac_gso_segment(skb, ..)
Quoted 4 lines
Link http://lkml.kernel.org/r/CAF=yD-KeAcTSOn4AxirAxL8m7QAS8GBBe1w09eziYwvPbbUeYA@mail.gmail.com open hereReported-by [email protected]Fixes c411ed854584 ("nsh: add GSO support")Signed-off-by Willem de Bruijn <[email protected]>
David Miller
maintainerFrom: Willem de Bruijn <[email protected]>
Date: Wed, 11 Jul 2018 12:00:44 -0400
Quoted 16 lines
From: Willem de Bruijn <[email protected]>
When pulling the NSH header in
nsh_gso_segment, set the mac length based on the encapsulated packet type.
skb_reset_mac_lencomputes an offset to the network header, which here still points to the outer packet:Quoted 7 lines
skb_reset_network_header(skb); [...] __skb_pull(skb, nsh_len); skb_reset_mac_header(skb); // now mac hdr starts nsh_len == 8B after net hdr skb_reset_mac_len(skb); // mac len = net hdr - mac hdr == (u16) -8 == 65528 [..] skb_mac_gso_segment(skb, ..)
Quoted 4 lines
Link http://lkml.kernel.org/r/CAF=yD-KeAcTSOn4AxirAxL8m7QAS8GBBe1w09eziYwvPbbUeYA@mail.gmail.com open hereReported-by [email protected]Fixes c411ed854584 ("nsh: add GSO support")Signed-off-by Willem de Bruijn <[email protected]>
Applied and queued up for -stable.
David Miller
maintainerRe: [PATCH net] packet: reset network header if packet shorter than ll reserved space
In reply to Willem de BruijnFrom: Willem de Bruijn <[email protected]>
Date: Wed, 11 Jul 2018 12:00:45 -0400
Quoted 10 lines
From: Willem de Bruijn <[email protected]>
If variable length link layer headers result in a packet shorter than
dev->hard_header_len, reset the network header offset. Elseskb->mac_lenmay exceedskb->lenafterskb_mac_reset_len.
packet_sendmsg_spktalready has similar logic.Fixes b84bbaf7a6c8 ("packet: in packet_snd start writing at link layer allocation")Signed-off-by Willem de Bruijn <[email protected]>
Applied and queued up for -stable.
Re: [PATCH net] selftests: in udpgso_bench do not test udp zerocopy
In reply to Willem de BruijnFrom: Willem de Bruijn <[email protected]>
Date: Wed, 11 Jul 2018 12:00:46 -0400
Quoted 6 lines
From: Willem de Bruijn <[email protected]>
The udpgso benchmark compares various configurations of UDP and TCP. Including one that is not upstream, udp zerocopy. This is a leftover from the earlier RFC patchset.
Quoted 6 lines
The test is part of kselftests and run in continuous spinners. Remove the failing case to make the test start passing.
Fixes 3a687bef148d ("selftests: udp gso benchmark")Reported-by Naresh Kamboju <[email protected]>Signed-off-by Willem de Bruijn <[email protected]>
Applied.