ipsec: fix NAT-T ports and length
Fix the UDP header fields, wrong byte order used for src and dst port and wrong offset used when updating UDP datagram length. Fixes: 01eef5907fc3 ("ipsec: support NAT-T") Cc: stable@dpdk.org Signed-off-by: Radu Nicolau <radu.nicolau@intel.com> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
This commit is contained in:
parent
1c2d2685a5
commit
778bbc0891
lib/ipsec
@ -196,7 +196,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc,
|
||||
/* if UDP encap is enabled update the dgram_len */
|
||||
if (sa->type & RTE_IPSEC_SATP_NATT_ENABLE) {
|
||||
struct rte_udp_hdr *udph = (struct rte_udp_hdr *)
|
||||
(ph - sizeof(struct rte_udp_hdr));
|
||||
(ph + sa->hdr_len - sizeof(struct rte_udp_hdr));
|
||||
udph->dgram_len = rte_cpu_to_be_16(mb->pkt_len - sqh_len -
|
||||
sa->hdr_l3_off - sa->hdr_len);
|
||||
}
|
||||
|
@ -364,8 +364,8 @@ esp_outb_tun_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm)
|
||||
struct rte_udp_hdr *udph = (struct rte_udp_hdr *)
|
||||
&sa->hdr[prm->tun.hdr_len];
|
||||
sa->hdr_len += sizeof(struct rte_udp_hdr);
|
||||
udph->src_port = prm->ipsec_xform.udp.sport;
|
||||
udph->dst_port = prm->ipsec_xform.udp.dport;
|
||||
udph->src_port = rte_cpu_to_be_16(prm->ipsec_xform.udp.sport);
|
||||
udph->dst_port = rte_cpu_to_be_16(prm->ipsec_xform.udp.dport);
|
||||
udph->dgram_cksum = 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user