Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-10 Thread Radu Nicolau
On 10-Jul-23 10:24 AM, Konstantin Ananyev wrote: 07/07/2023 14:26, Radu Nicolau пишет: On 07-Jul-23 1:51 PM, Xiao Liang wrote: sa->hdr_len and prm->tun.hdr_len don't include L2 length so both should start in the diagram at the end of the ETH header. So the right way to compute datagram len

Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-10 Thread Konstantin Ananyev
07/07/2023 14:26, Radu Nicolau пишет: On 07-Jul-23 1:51 PM, Xiao Liang wrote: sa->hdr_len and prm->tun.hdr_len don't include L2 length so both should start in the diagram at the end of the ETH header. So the right way to compute datagram length is dgram_len = mb->pkt_len - sqh_len - sa->hdr_l

Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-07 Thread Radu Nicolau
On 07-Jul-23 1:51 PM, Xiao Liang wrote: sa->hdr_len and prm->tun.hdr_len don't include L2 length so both should start in the diagram at the end of the ETH header. So the right way to compute datagram length is dgram_len = mb->pkt_len - sqh_len - sa->hdr_l3_off - sa->hdr_len + sizeof(struct rt

Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-07 Thread Xiao Liang
The context hlen = sa->hdr_len + sa->iv_len + sizeof(*esph); ... ph = rte_pktmbuf_prepend(mb, hlen - l2len); ... update_tun_outb_l3hdr(sa, ph + sa->hdr_l3_off, ph + hlen, mb->pkt_len - sqh_len, sa->hdr_l3_off, sqn_low16(sqc)); assumes L2 header length included in sa->h

Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-07 Thread Xiao Liang
> sa->hdr_len and prm->tun.hdr_len don't include L2 length so both should > start in the diagram at the end of the ETH header. > > So the right way to compute datagram length is > > dgram_len = mb->pkt_len - sqh_len - sa->hdr_l3_off - sa->hdr_len + > sizeof(struct rte_udp_hdr) > |<- mb->

Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-07 Thread Radu Nicolau
On 07-Jul-23 4:12 AM, Xiao Liang wrote: |<- mb->pkt_len - sqh_len ->| |<-sa->hdr_len->| |<- sa->hdr_l3_off ->||<- udph->dgram_len ->| +++-+-+-+-+ | ETH| IP

Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-06 Thread Xiao Liang
|<- mb->pkt_len - sqh_len ->| |<-sa->hdr_len->| |<- sa->hdr_l3_off ->||<- udph->dgram_len ->| +++-+-+-+-+ | ETH| IP | UDP | ESP | payload | sqh | +---

Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-06 Thread Xiao Liang
Well, let me explain. > >>> diff --git a/lib/ipsec/esp_outb.c b/lib/ipsec/esp_outb.c > >>> index 9cbd9202f6..ec87b1dce2 100644 > >>> --- a/lib/ipsec/esp_outb.c > >>> +++ b/lib/ipsec/esp_outb.c > >>> @@ -198,7 +198,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, > >>> rte_be64_t sqc, > >>>

Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-06 Thread Radu Nicolau
On 06-Jul-23 10:08 AM, Konstantin Ananyev wrote: Hi Akhil, Hi Konstantin, Can you review this patch? UDP header length is included in sa->hdr_len. Take care of that in L3 header and pakcet length calculation. Fixes: 01eef5907fc3 ("ipsec: support NAT-T") Signed-off-by: Xiao Liang --- li

RE: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-06 Thread Konstantin Ananyev
Hi Akhil, > > Hi Konstantin, > Can you review this patch? > > > UDP header length is included in sa->hdr_len. Take care of that in > > L3 header and pakcet length calculation. > > > > Fixes: 01eef5907fc3 ("ipsec: support NAT-T") > > > > Signed-off-by: Xiao Liang > > --- > > lib/ipsec/esp_out

RE: [EXT] [PATCH] ipsec: fix NAT-T length calculation

2023-07-05 Thread Akhil Goyal
Hi Konstantin, Can you review this patch? > UDP header length is included in sa->hdr_len. Take care of that in > L3 header and pakcet length calculation. > > Fixes: 01eef5907fc3 ("ipsec: support NAT-T") > > Signed-off-by: Xiao Liang > --- > lib/ipsec/esp_outb.c | 2 +- > lib/ipsec/sa.c |