From: Steve Chew (stechew) Date: Wed, 27 Oct 2021 10:41:14 +0000 (+0000) Subject: Merge pull request #3101 in SNORT/snort3 from ~RAMANKS/snort3:geneve to master X-Git-Tag: 3.1.16.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9e728caf3f63381980a2ce2b6447988fbab0f6e;p=thirdparty%2Fsnort3.git Merge pull request #3101 in SNORT/snort3 from ~RAMANKS/snort3:geneve to master Squashed commit of the following: commit 4d417498e15e097d5f1b7cdcfe8dca253784a5f5 Author: Raman Krishnan Date: Mon Oct 11 22:53:34 2021 -0700 codec: geneve: injected packets should have geneve port in outer udp header --- diff --git a/src/codecs/ip/cd_udp.cc b/src/codecs/ip/cd_udp.cc index b6668f1ea..371f654a6 100644 --- a/src/codecs/ip/cd_udp.cc +++ b/src/codecs/ip/cd_udp.cc @@ -504,7 +504,8 @@ bool UdpCodec::encode(const uint8_t* const raw_in, const uint16_t /*raw_len*/, const udp::UDPHdr* const hi = reinterpret_cast(raw_in); udp::UDPHdr* const udph_out = reinterpret_cast(buf.data()); - if ( enc.forward() ) + // irrespective of direction, for geneve, don't swap the ports + if ( enc.forward() || config->is_geneve_port(ntohs(hi->uh_dport)) ) { udph_out->uh_sport = hi->uh_sport; udph_out->uh_dport = hi->uh_dport;