From 2a56c52fcbf0bb6fbc2f730309f77bf7ed2866f9 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Sun, 9 Nov 2014 16:58:07 +0200 Subject: [PATCH] net: distribute udp packets according to address pair --- net/udp.cc | 3 ++- net/udp.hh | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/net/udp.cc b/net/udp.cc index 450da994c7..d3ce86a02f 100644 --- a/net/udp.cc +++ b/net/udp.cc @@ -98,8 +98,9 @@ unsigned udp_v4::forward(packet& p, size_t off, ipv4_address from, ipv4_address } auto dst = ntoh(uh->dst_port); + auto src = ntoh(uh->src_port); - return dst % smp::count; + return connid_hash()(connid{to, from, dst, src}) % smp::count; } void udp_v4::received(packet p, ipv4_address from, ipv4_address to) diff --git a/net/udp.hh b/net/udp.hh index f188480ddf..ecd260352c 100644 --- a/net/udp.hh +++ b/net/udp.hh @@ -41,6 +41,9 @@ struct udp_channel_state { }; class udp_v4 : ip_protocol { + using connid = l4connid; + using connid_hash = typename connid::connid_hash; + public: static const int default_queue_size; private: