]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #3101 in SNORT/snort3 from ~RAMANKS/snort3:geneve to master
authorSteve Chew (stechew) <stechew@cisco.com>
Wed, 27 Oct 2021 10:41:14 +0000 (10:41 +0000)
committerSteve Chew (stechew) <stechew@cisco.com>
Wed, 27 Oct 2021 10:41:14 +0000 (10:41 +0000)
Squashed commit of the following:

commit 4d417498e15e097d5f1b7cdcfe8dca253784a5f5
Author: Raman Krishnan <ramanks@cisco.com>
Date:   Mon Oct 11 22:53:34 2021 -0700

    codec: geneve: injected packets should have geneve port in outer udp header

src/codecs/ip/cd_udp.cc

index b6668f1eae7a95183bbd67cfa6a5fb632214f31f..371f654a6bd7c2fe2c6729b9d66d10389de93e32 100644 (file)
@@ -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<const udp::UDPHdr*>(raw_in);
     udp::UDPHdr* const udph_out = reinterpret_cast<udp::UDPHdr*>(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;