Message ID | 20180919203257.94597-1-jpettit@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] sflow: Set agent address properly based on collector address. | expand |
On Wed, Sep 19, 2018 at 01:32:57PM -0700, Justin Pettit wrote: > 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@inmon.com> > Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
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; } }
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@inmon.com> Signed-off-by: Justin Pettit <jpettit@ovn.org> --- ofproto/ofproto-dpif-sflow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)