diff options
author | shwethab <shwetha.bhandari@gmail.com> | 2017-03-09 16:58:26 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-03-14 12:04:50 +0000 |
commit | e146f13fa0c315c41b8172b5f7bb65dfd612c325 (patch) | |
tree | b41490fdf768018d9422dc92b9e52292fccd7f95 /src/vnet/sr/sr_localsid.c | |
parent | 20e272c8fce5571122ca149526ee8ddf6f43ee3f (diff) |
ioam: ip6 hop by hop ext header and SR header co-existence
1. Fix finding sr extension header
2. Fix for assert checks for space for sr header in packet headroom
3. ioam build warnings
4. Fix for SR header removal in presence of hbh ext header
clib_memcpy with overlapping src/dst was failing
Change-Id: I8576204eb571d1d4725a4e6976e18fe61cd1cd35
Signed-off-by: shwethab <shwetha.bhandari@gmail.com>
Diffstat (limited to 'src/vnet/sr/sr_localsid.c')
-rwxr-xr-x | src/vnet/sr/sr_localsid.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/vnet/sr/sr_localsid.c b/src/vnet/sr/sr_localsid.c index 407491ce19f..610bb7ffbea 100755 --- a/src/vnet/sr/sr_localsid.c +++ b/src/vnet/sr/sr_localsid.c @@ -827,6 +827,9 @@ end_psp_srh_processing (vlib_node_runtime_t * node, ip6_sr_localsid_t * ls0, u32 * next0) { u32 new_l0, sr_len; + u64 *copy_dst0, *copy_src0; + u32 copy_len_u64s0 = 0; + int i; if (PREDICT_TRUE (sr0->type == ROUTING_HEADER_TYPE_SR)) { @@ -845,8 +848,25 @@ end_psp_srh_processing (vlib_node_runtime_t * node, vlib_buffer_advance (b0, sr_len); new_l0 = clib_net_to_host_u16 (ip0->payload_length) - sr_len; ip0->payload_length = clib_host_to_net_u16 (new_l0); - clib_memcpy ((void *) ip0 + sr_len, ip0, - (void *) sr0 - (void *) ip0); + copy_src0 = (u64 *) ip0; + copy_dst0 = copy_src0 + (sr0->length + 1); + /* number of 8 octet units to copy + * By default in absence of extension headers it is equal to length of ip6 header + * With extension headers it number of 8 octet units of ext headers preceding + * SR header + */ + copy_len_u64s0 = + (((u8 *) sr0 - (u8 *) ip0) - sizeof (ip6_header_t)) >> 3; + copy_dst0[4 + copy_len_u64s0] = copy_src0[4 + copy_len_u64s0]; + copy_dst0[3 + copy_len_u64s0] = copy_src0[3 + copy_len_u64s0]; + copy_dst0[2 + copy_len_u64s0] = copy_src0[2 + copy_len_u64s0]; + copy_dst0[1 + copy_len_u64s0] = copy_src0[1 + copy_len_u64s0]; + copy_dst0[0 + copy_len_u64s0] = copy_src0[0 + copy_len_u64s0]; + + for (i = copy_len_u64s0 - 1; i >= 0; i--) + { + copy_dst0[i] = copy_src0[i]; + } if (ls0->behavior == SR_BEHAVIOR_X) { |