Skip to content

Commit

Permalink
sflow: Set agent address properly based on collector address.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Justin Pettit <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
justinpettit committed Sep 27, 2018
1 parent 49fd74c commit 5c6590e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ofproto/ofproto-dpif-sflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 5c6590e

Please sign in to comment.