aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorGabriel Ganne <gabriel.ganne@enea.com>2017-03-06 15:19:40 +0100
committerJohn Lo <loj@cisco.com>2017-03-07 21:34:44 +0000
commitf7f2a9feaa2cad8313afba53b53c32f1928f664c (patch)
treeb300924abe7e74595861102e279028046b263325 /src/vnet
parent45e4f365086267ef2551b1dedf4e309bdd00a34a (diff)
fix gcc 5.4 warning: argument to 'sizeof' in 'memcpy' call is the same expression as the destination
warning translates as an invalid write : sizeof(u8* b_dmac) == 8 != sizeof(eth_hdr->dst_address) == 6 ~/vpp/build-data/../src/vnet/l2/l2_vtr.c: In function 'l2pbb_get': ~/vpp/build-data/../src/vnet/l2/l2_vtr.c:734:63: error: argument to 'sizeof' in 'memcpy' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] ~/vpp/build-data/../src/vnet/l2/l2_vtr.c:736:63: error: argument to 'sizeof' in 'memcpy' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] update l2pbb_get to take an ethernet header instead of two u8* pointers for source and dest mac addresses. Change-Id: Ifcf1319a9e22614d57682f940e10f0420dc6fb8c Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/interface_api.c14
-rw-r--r--src/vnet/l2/l2_vtr.c16
-rw-r--r--src/vnet/l2/l2_vtr.h2
3 files changed, 15 insertions, 17 deletions
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index bfd2af31a58..2b6ff0c590a 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -205,21 +205,21 @@ send_sw_interface_details (vpe_api_main_t * am,
}
/* pbb tag rewrite data */
+ ethernet_header_t eth_hdr;
u32 vtr_op = L2_VTR_DISABLED;
u16 outer_tag = 0;
- u8 b_dmac[6];
- u8 b_smac[6];
u16 b_vlanid = 0;
u32 i_sid = 0;
- memset (b_dmac, 0, sizeof (b_dmac));
- memset (b_smac, 0, sizeof (b_smac));
+ memset (&eth_hdr, 0, sizeof (eth_hdr));
if (!l2pbb_get (am->vlib_main, am->vnet_main, swif->sw_if_index,
- &vtr_op, &outer_tag, b_dmac, b_smac, &b_vlanid, &i_sid))
+ &vtr_op, &outer_tag, &eth_hdr, &b_vlanid, &i_sid))
{
mp->sub_dot1ah = 1;
- clib_memcpy (mp->b_dmac, b_dmac, sizeof (b_dmac));
- clib_memcpy (mp->b_smac, b_smac, sizeof (b_smac));
+ clib_memcpy (mp->b_dmac, eth_hdr.dst_address,
+ sizeof (eth_hdr.dst_address));
+ clib_memcpy (mp->b_smac, eth_hdr.src_address,
+ sizeof (eth_hdr.src_address));
mp->b_vlanid = b_vlanid;
mp->i_sid = i_sid;
}
diff --git a/src/vnet/l2/l2_vtr.c b/src/vnet/l2/l2_vtr.c
index e03a4880a5e..3c5365f9b51 100644
--- a/src/vnet/l2/l2_vtr.c
+++ b/src/vnet/l2/l2_vtr.c
@@ -687,7 +687,7 @@ VLIB_CLI_COMMAND (int_l2_vtr_cli, static) = {
*/
u32
l2pbb_get (vlib_main_t * vlib_main, vnet_main_t * vnet_main, u32 sw_if_index,
- u32 * vtr_op, u16 * outer_tag, u8 * b_dmac, u8 * b_smac,
+ u32 * vtr_op, u16 * outer_tag, ethernet_header_t * eth_hdr,
u16 * b_vlanid, u32 * i_sid)
{
u32 error = 1;
@@ -702,8 +702,6 @@ l2pbb_get (vlib_main_t * vlib_main, vnet_main_t * vnet_main, u32 sw_if_index,
*vtr_op = L2_VTR_DISABLED;
*outer_tag = 0;
- *b_dmac = 0;
- *b_smac = 0;
*b_vlanid = 0;
*i_sid = 0;
@@ -731,16 +729,16 @@ l2pbb_get (vlib_main_t * vlib_main, vnet_main_t * vnet_main, u32 sw_if_index,
else if (in_config->push_bytes)
*vtr_op = L2_VTR_PUSH_2;
- clib_memcpy (b_dmac, in_config->macs_tags.b_dst_address,
- sizeof (b_dmac));
- clib_memcpy (b_smac, in_config->macs_tags.b_src_address,
- sizeof (b_smac));
+ clib_memcpy (&eth_hdr->dst_address, in_config->macs_tags.b_dst_address,
+ sizeof (eth_hdr->dst_address));
+ clib_memcpy (&eth_hdr->src_address, in_config->macs_tags.b_src_address,
+ sizeof (eth_hdr->src_address));
*b_vlanid =
clib_host_to_net_u16 (in_config->macs_tags.priority_dei_id) & 0xFFF;
*i_sid =
- clib_host_to_net_u32 (in_config->
- macs_tags.priority_dei_uca_res_sid) & 0xFFFFF;
+ clib_host_to_net_u32 (in_config->macs_tags.
+ priority_dei_uca_res_sid) & 0xFFFFF;
error = 0;
}
done:
diff --git a/src/vnet/l2/l2_vtr.h b/src/vnet/l2/l2_vtr.h
index 99aedc970db..0aea618e080 100644
--- a/src/vnet/l2/l2_vtr.h
+++ b/src/vnet/l2/l2_vtr.h
@@ -267,7 +267,7 @@ u32 l2pbb_get (vlib_main_t * vlib_main,
u32 sw_if_index,
u32 * vtr_op,
u16 * outer_tag,
- u8 * b_dmac, u8 * b_smac, u16 * b_vlanid, u32 * i_sid);
+ ethernet_header_t * eth_hdr, u16 * b_vlanid, u32 * i_sid);
#endif /* included_vnet_l2_vtr_h */