aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/snat
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-01-13 05:35:34 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-01-13 15:44:35 +0000
commit67e7fcb181c2eeeb14f3bd9f88a3c5ee4dc51a17 (patch)
tree202fd2b617fd30f83ed2290e1f1a2c9f3ef1881f /src/plugins/snat
parent35b2607fcd033a18a32ba61b44e68d6e9e3eeeca (diff)
SNAT: fixed crash - interface without IP address (VPP-599)
Change-Id: I7f4d0cbde3d3c4ed6537e6351d5487546daea058 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/snat')
-rw-r--r--src/plugins/snat/in2out.c25
-rw-r--r--src/plugins/snat/out2in.c10
2 files changed, 28 insertions, 7 deletions
diff --git a/src/plugins/snat/in2out.c b/src/plugins/snat/in2out.c
index c78fdd76631..cd8f1271808 100644
--- a/src/plugins/snat/in2out.c
+++ b/src/plugins/snat/in2out.c
@@ -350,7 +350,10 @@ static inline u32 icmp_in2out_slow_path (snat_main_t *sm,
ip4_interface_first_address (sm->ip4_main, sw_if_index0,
0 /* just want the address */);
rt->cached_sw_if_index = sw_if_index0;
- rt->cached_ip4_address = first_int_addr->as_u32;
+ if (first_int_addr)
+ rt->cached_ip4_address = first_int_addr->as_u32;
+ else
+ rt->cached_ip4_address = 0;
}
/* Don't NAT packet aimed at the intfc address */
@@ -640,7 +643,10 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
ip4_interface_first_address (sm->ip4_main, sw_if_index0,
0 /* just want the address */);
rt->cached_sw_if_index = sw_if_index0;
- rt->cached_ip4_address = first_int_addr->as_u32;
+ if (first_int_addr)
+ rt->cached_ip4_address = first_int_addr->as_u32;
+ else
+ rt->cached_ip4_address = 0;
}
/* Don't NAT packet aimed at the intfc address */
@@ -788,7 +794,10 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
ip4_interface_first_address (sm->ip4_main, sw_if_index1,
0 /* just want the address */);
rt->cached_sw_if_index = sw_if_index1;
- rt->cached_ip4_address = first_int_addr->as_u32;
+ if (first_int_addr)
+ rt->cached_ip4_address = first_int_addr->as_u32;
+ else
+ rt->cached_ip4_address = 0;
}
/* Don't NAT packet aimed at the intfc address */
@@ -971,7 +980,10 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
ip4_interface_first_address (sm->ip4_main, sw_if_index0,
0 /* just want the address */);
rt->cached_sw_if_index = sw_if_index0;
- rt->cached_ip4_address = first_int_addr->as_u32;
+ if (first_int_addr)
+ rt->cached_ip4_address = first_int_addr->as_u32;
+ else
+ rt->cached_ip4_address = 0;
}
/* Don't NAT packet aimed at the intfc address */
@@ -1350,7 +1362,10 @@ static inline u32 icmp_in2out_static_map (snat_main_t *sm,
ip4_interface_first_address (sm->ip4_main, sw_if_index0,
0 /* just want the address */);
rt->cached_sw_if_index = sw_if_index0;
- rt->cached_ip4_address = first_int_addr->as_u32;
+ if (first_int_addr)
+ rt->cached_ip4_address = first_int_addr->as_u32;
+ else
+ rt->cached_ip4_address = 0;
}
/* Don't NAT packet aimed at the intfc address */
diff --git a/src/plugins/snat/out2in.c b/src/plugins/snat/out2in.c
index 9e5a8af8743..0c9c9cd12b6 100644
--- a/src/plugins/snat/out2in.c
+++ b/src/plugins/snat/out2in.c
@@ -255,7 +255,10 @@ static inline u32 icmp_out2in_slow_path (snat_main_t *sm,
ip4_interface_first_address (sm->ip4_main, sw_if_index0,
0 /* just want the address */);
rt->cached_sw_if_index = sw_if_index0;
- rt->cached_ip4_address = first_int_addr->as_u32;
+ if (first_int_addr)
+ rt->cached_ip4_address = first_int_addr->as_u32;
+ else
+ rt->cached_ip4_address = 0;
}
/* Don't NAT packet aimed at the intfc address */
@@ -1043,7 +1046,10 @@ static inline u32 icmp_out2in_fast (snat_main_t *sm,
ip4_interface_first_address (sm->ip4_main, sw_if_index0,
0 /* just want the address */);
rt->cached_sw_if_index = sw_if_index0;
- rt->cached_ip4_address = first_int_addr->as_u32;
+ if (first_int_addr)
+ rt->cached_ip4_address = first_int_addr->as_u32;
+ else
+ rt->cached_ip4_address = 0;
}
/* Don't NAT packet aimed at the intfc address */