summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjiangxiaoming <jiangxiaoming@outlook.com>2020-06-22 09:06:16 +0800
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-18 19:47:21 +0000
commit806f3f617784fbc507fd8a8ed3e1cce75915a66b (patch)
treef0e0fb14c85acb98c79e49b7856ce0fcf669a1da /src
parent15c9670d9d8c86a3ec242d5b106bc41d9879c13d (diff)
ip: set ip4 mask for ip_copy and ip_set when dealing with ip4 type
Type: fix Signed-off-by: jiangxiaoming <jiangxiaoming@outlook.com> Change-Id: I3ace7dfe3ddacb4f7fa7a974a2ffe2b3cf902ff9 (cherry picked from commit 9268b5823fa7a16195f638e5b1f9c54b430f2f3c)
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/ip.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/vnet/ip/ip.c b/src/vnet/ip/ip.c
index 785cd491b57..3ecea9b8b27 100644
--- a/src/vnet/ip/ip.c
+++ b/src/vnet/ip/ip.c
@@ -81,7 +81,10 @@ void
ip_copy (ip46_address_t * dst, ip46_address_t * src, u8 is_ip4)
{
if (is_ip4)
- dst->ip4.as_u32 = src->ip4.as_u32;
+ {
+ ip46_address_mask_ip4 (dst);
+ dst->ip4.as_u32 = src->ip4.as_u32;
+ }
else
clib_memcpy_fast (&dst->ip6, &src->ip6, sizeof (ip6_address_t));
}
@@ -90,7 +93,10 @@ void
ip_set (ip46_address_t * dst, void *src, u8 is_ip4)
{
if (is_ip4)
- dst->ip4.as_u32 = ((ip4_address_t *) src)->as_u32;
+ {
+ ip46_address_mask_ip4 (dst);
+ dst->ip4.as_u32 = ((ip4_address_t *) src)->as_u32;
+ }
else
clib_memcpy_fast (&dst->ip6, (ip6_address_t *) src,
sizeof (ip6_address_t));