-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cast align warning #894
Conversation
Signed-off-by: Ze Gan <[email protected]>
vslib/src/TrafficForwarder.cpp
Outdated
@@ -37,7 +37,7 @@ void TrafficForwarder::addVlanTag( | |||
if (cmsg->cmsg_level != SOL_PACKET || cmsg->cmsg_type != PACKET_AUXDATA) | |||
continue; | |||
|
|||
struct tpacket_auxdata* aux = (struct tpacket_auxdata*)CMSG_DATA(cmsg); | |||
struct tpacket_auxdata* aux = (struct tpacket_auxdata*)(void *)CMSG_DATA(cmsg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this is not the proper solution here, issue is about cast align, which void* probably will not solve, but i didnt tested that on gcc10, i had similar issue with armhf which is different platform and have different memory requirements
which i fixed this way: #738
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will follow your solution.
Actually, this solution comes from the source code of OVS (https://mail.openvswitch.org/pipermail/ovs-dev/2014-January/279545.html)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, i tested this
on x64 gcc10: https://godbolt.org/z/rv4fKxTMb (no errors in any situation)
but on arm32: https://godbolt.org/z/T73h7v5jd you get original warning, but void seems to fix it, you can get back to that void* if you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I reset it.
ce6c44c
to
3ba8101
Compare
… fix_cast_align
Signed-off-by: Ze Gan <[email protected]>
…onic-net#1507) * Skip records of FDB entries, which are linked to default Vlan 1, to prevent exception throwing while performing command 'show mac' or 'fdbshow'. #### What I did Resolves sonic-net#894 Fixed "show mac" command execution failure in case, when the system has an FDB entry, which is linked to default Vlan 1. The failure is caused by throwing exception, while trying to get int from None type object. #### How I did it The condition has added to src/sonic-utilities/scripts/fdbshow script to handle and skip FDB entries, for which the system can not get Vlan ID. #### How to verify it Configure your system to receive both tagged and untagged traffic. For example, you could use the next steps: Do configuration on DUT sudo config portchannel add PortChannel0002 sudo config portchannel member add PortChannel0002 Ethernet68 sudo config vlan add 40 sudo config vlan member add 40 PortChannel0002 sudo config interface ip add Vlan40 40.0.0.1/24 Do configuration on Linux host sudo ip link add bond0 type bond sudo ip link set dev bond0 type bond mode 4 sudo ip link set enp5s0f1 down sudo ip link set enp5s0f1 master bond0 sudo ip link set enp5s0f1 up sudo ip link set bond0 up sudo ip link add link bond0 name bond0.40 type vlan id 40 sudo ip link set bond0.40 up sudo ip addr add 40.0.0.3/24 dev bond0.40 Do ping from linux host to DUT IP 40.0.0.1 Do command "show mac" on DUT "show mac" command should not be finished with the next message: int() argument must be a string, a bytes-like object or a number, not 'NoneType'. Instead, the normal output of the command should be shown. #### Additional information Cherry-pick of sonic-net/sonic-utilities#1368. Pay attention, additional change is required. HEAD of https://github.com/Azure/sonic-py-swsssdk submodule of buildimage should be updated and be pointed to the top of 201911 branch, because current head of the submodule causes KeyError exception raising inside function `get_vlan_id_from_bvid` of `port_util.py` module: ``` SAI_VLAN_ATTR_VLAN_ID ('SAI_VLAN_ATTR_VLAN_ID',) Failed to get Vlan id for bvid oid:0x26000000000013 ``` The raising has already fixed on the top of 201911 branch of the submodule.
Fix warning: cast from 'unsigned char*' to 'tpacket_auxdata*' increases required alignment of target type [-Wcast-align]
Signed-off-by: Ze Gan [email protected]