[ovs-dev] [PATCH] sflow: Set agent address properly based on collector address.

Justin Pettit jpettit at ovn.org
Wed Sep 19 20:32:57 UTC 2018


If an agent address is not provided, OVS tries to choose a source
address based on the source IP that would be used to connect to the
sFlow collector.  The code previously set the agent address to the
collector's address instead of using the calculated source address.
This patch properly uses the source address.

Reported-by: Neil McKee <neil.mckee at inmon.com>
Signed-off-by: Justin Pettit <jpettit at ovn.org>
---
 ofproto/ofproto-dpif-sflow.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index d17d7a8be83c..62a09b5d1b1e 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -472,11 +472,12 @@ sflow_choose_agent_address(const char *agent_device,
             /* sFlow only supports target in default routing table with
              * packet mark zero.
              */
-            ip = ss_get_address(&ss);
+            struct in6_addr target_ip = ss_get_address(&ss);
 
             struct in6_addr gw, src = in6addr_any;
             char name[IFNAMSIZ];
-            if (ovs_router_lookup(0, &ip, name, &src, &gw)) {
+            if (ovs_router_lookup(0, &target_ip, name, &src, &gw)) {
+                ip = src;
                 goto success;
             }
         }
-- 
2.17.1



More information about the dev mailing list