NAT64: bug fix
ICMP to ICMPv6 error message inner UDP packet translation delete ST entries when deleting static BIB entry Change-Id: I2a28631ac040e20827a692331506cd8254f70916 Signed-off-by: Matus Fabian <matfabia@cisco.com>
This commit is contained in:
Matus Fabian
committed by
Neale Ranns
parent
0fc6595add
commit
89223f4623
@ -107,6 +107,8 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
|
||||
nat64_db_bib_entry_key_t bibe_key;
|
||||
clib_bihash_kv_24_8_t kv;
|
||||
nat64_db_bib_entry_t *bib;
|
||||
u32 *ste_to_be_free = 0, *ste_index, bibe_index;
|
||||
nat64_db_st_entry_t *st, *ste;
|
||||
|
||||
switch (bibe->proto)
|
||||
{
|
||||
@ -114,6 +116,7 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
|
||||
#define _(N, i, n, s) \
|
||||
case SNAT_PROTOCOL_##N: \
|
||||
bib = db->bib._##n##_bib; \
|
||||
st = db->st._##n##_st; \
|
||||
break;
|
||||
foreach_snat_protocol
|
||||
#undef _
|
||||
@ -123,6 +126,21 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
|
||||
return;
|
||||
}
|
||||
|
||||
bibe_index = bibe - bib;
|
||||
|
||||
/* delete ST entries for static BIB entry */
|
||||
if (bibe->is_static)
|
||||
{
|
||||
pool_foreach (ste, st, (
|
||||
{
|
||||
if (ste->bibe_index == bibe_index)
|
||||
vec_add1 (ste_to_be_free, ste - st);}
|
||||
));
|
||||
vec_foreach (ste_index, ste_to_be_free)
|
||||
nat64_db_st_entry_free (db, pool_elt_at_index (st, ste_index[0]));
|
||||
vec_free (ste_to_be_free);
|
||||
}
|
||||
|
||||
/* delete hash lookup */
|
||||
bibe_key.addr.as_u64[0] = bibe->in_addr.as_u64[0];
|
||||
bibe_key.addr.as_u64[1] = bibe->in_addr.as_u64[1];
|
||||
@ -146,6 +164,7 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
|
||||
|
||||
/* delete from pool */
|
||||
pool_put (bib, bibe);
|
||||
|
||||
}
|
||||
|
||||
nat64_db_bib_entry_t *
|
||||
@ -480,7 +499,7 @@ nad64_db_st_free_expired (nat64_db_t * db, u32 now)
|
||||
vec_add1 (ste_to_be_free, ste - st); \
|
||||
})); \
|
||||
vec_foreach (ste_index, ste_to_be_free) \
|
||||
pool_put_index (st, ste_index[0]); \
|
||||
nat64_db_st_entry_free (db, pool_elt_at_index(st, ste_index[0])); \
|
||||
vec_free (ste_to_be_free); \
|
||||
ste_to_be_free = 0;
|
||||
foreach_snat_protocol
|
||||
|
@ -367,11 +367,15 @@ icmp_to_icmp6 (vlib_buffer_t * p, ip4_to_ip6_set_fn_t fn, void *ctx,
|
||||
sizeof (*inner_frag));
|
||||
}
|
||||
|
||||
csum = ip_csum_add_even (csum, inner_ip6->src_address.as_u64[0]);
|
||||
csum = ip_csum_add_even (csum, inner_ip6->src_address.as_u64[1]);
|
||||
csum = ip_csum_add_even (csum, inner_ip6->dst_address.as_u64[0]);
|
||||
csum = ip_csum_add_even (csum, inner_ip6->dst_address.as_u64[1]);
|
||||
*inner_L4_checksum = ip_csum_fold (csum);
|
||||
/* UDP checksum is optional */
|
||||
if (csum)
|
||||
{
|
||||
csum = ip_csum_add_even (csum, inner_ip6->src_address.as_u64[0]);
|
||||
csum = ip_csum_add_even (csum, inner_ip6->src_address.as_u64[1]);
|
||||
csum = ip_csum_add_even (csum, inner_ip6->dst_address.as_u64[0]);
|
||||
csum = ip_csum_add_even (csum, inner_ip6->dst_address.as_u64[1]);
|
||||
*inner_L4_checksum = ip_csum_fold (csum);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user