summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwenxu <wenxu@chinatelecom.cn>2022-04-01 11:02:27 -0400
committerIlya Maximets <i.maximets@ovn.org>2022-05-25 21:11:32 +0200
commitc5bcbd58d6d1f071a9dfde643b6bd61ea0f60883 (patch)
tree7d275b949108d54e50fe8477b31b24c0a27a2685
parent743b53622a357a9a8cc4a16c011fd5d015b74968 (diff)
downloadopenvswitch-c5bcbd58d6d1f071a9dfde643b6bd61ea0f60883.tar.gz
ovs-router: Expose the ovs_router_get_netdev_source_address function.
Rename get_src_addr to ovs_router_get_netdev_source_address and expose this function to be used in the next commit. Signed-off-by: wenxu <wenxu@chinatelecom.cn> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r--lib/ovs-router.c13
-rw-r--r--lib/ovs-router.h4
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/ovs-router.c b/lib/ovs-router.c
index 09b81c6e5..5d0fbd503 100644
--- a/lib/ovs-router.c
+++ b/lib/ovs-router.c
@@ -164,9 +164,10 @@ static void rt_init_match(struct match *match, uint32_t mark,
match->flow.pkt_mark = mark;
}
-static int
-get_src_addr(const struct in6_addr *ip6_dst,
- const char output_bridge[], struct in6_addr *psrc)
+int
+ovs_router_get_netdev_source_address(const struct in6_addr *ip6_dst,
+ const char output_bridge[],
+ struct in6_addr *psrc)
{
struct in6_addr *mask, *addr6;
int err, n_in6, i, max_plen = -1;
@@ -235,9 +236,11 @@ ovs_router_insert__(uint32_t mark, uint8_t priority, bool local,
p->plen = plen;
p->local = local;
p->priority = priority;
- err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
+ err = ovs_router_get_netdev_source_address(ip6_dst, output_bridge,
+ &p->src_addr);
if (err && ipv6_addr_is_set(gw)) {
- err = get_src_addr(gw, output_bridge, &p->src_addr);
+ err = ovs_router_get_netdev_source_address(gw, output_bridge,
+ &p->src_addr);
}
if (err) {
struct ds ds = DS_EMPTY_INITIALIZER;
diff --git a/lib/ovs-router.h b/lib/ovs-router.h
index 34ea163ee..d8ce3c00d 100644
--- a/lib/ovs-router.h
+++ b/lib/ovs-router.h
@@ -37,6 +37,10 @@ void ovs_router_flush(void);
void ovs_router_disable_system_routing_table(void);
+int ovs_router_get_netdev_source_address(const struct in6_addr *ip6_dst,
+ const char output_bridge[],
+ struct in6_addr *psrc);
+
#ifdef __cplusplus
}
#endif