summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorjxm <jiangxiaoming@outlook.com>2021-06-21 04:53:59 +0000
committerMatthew Smith <mgsmith@netgate.com>2021-08-25 21:22:16 +0000
commitee04de552d1749948e8802c2c6a87646f3b81625 (patch)
tree157e2b4c61f7657a4c2ff0e2e1e00cb9fb6f2e08 /src/vnet
parenta3f93e2fe318c096bc2eb50dd315d01064340681 (diff)
fib: fix source address get error for p2p if
Type: fix Signed-off-by: jxm <jiangxiaoming@outlook.com> Change-Id: I5a6a1ce9f232d4ed0fd4707cd5aa9b46cc8a2a5a
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/fib/fib_sas.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vnet/fib/fib_sas.c b/src/vnet/fib/fib_sas.c
index 230fcd17bf6..8abac8672fd 100644
--- a/src/vnet/fib/fib_sas.c
+++ b/src/vnet/fib/fib_sas.c
@@ -61,6 +61,18 @@ fib_sas4_get (u32 sw_if_index,
d_tmp.ip4 = *dst;
}
+ if (vnet_sw_interface_is_p2p(vnet_get_main(), sw_if_index))
+ {
+ ip4_address_t *ip4;
+ ip4 = ip_interface_get_first_ip (sw_if_index, 1);
+ if (ip4) {
+ src->as_u32 = ip4->as_u32;
+ return (true);
+ } else {
+ return (false);
+ }
+ }
+
/*
* If the interface is unnumbered then use the IP interface
*/
@@ -111,6 +123,18 @@ fib_sas6_get (u32 sw_if_index,
return (true);
}
+ if (vnet_sw_interface_is_p2p(vnet_get_main(), sw_if_index))
+ {
+ ip6_address_t *ip6;
+ ip6 = ip_interface_get_first_ip (sw_if_index, 0);
+ if (ip6) {
+ ip6_address_copy(src, ip6);
+ return (true);
+ } else {
+ return (false);
+ }
+ }
+
/*
* get the source address from the glean adjacency
*/