Updating arp responder.py to capture and use vlan from packet#1201
Updating arp responder.py to capture and use vlan from packet#1201prsunny merged 2 commits intosonic-net:masterfrom
Conversation
Fixes based on UT
|
@dgsudharsan , do we need to make any change to existing PTF docker for this to run? |
Yes. It has been done and changes have been merged |
|
@volodymyrsamotiy , can you check this? |
|
Looks like still not fully working when there are multiple VLAN interfaces/neighbors on one physical port. (when run VNET test with default parameters all works good) Below is the neighbors dump snippet from DUT during running above test. |
|
Hi, |
|
I tried it manually and observed the same behavior. ARP responder was running all the time and I applied JSON config with the neighbors, Some neighbors were not resolved, it always the same number and the same neighbors. Looks like it happens for the neighbors which are configured on different VLAN interfaces but if interfaces are configured on the same physical port. For example, looking at VNET config, we have the following configured: Below is the part of ARP responder config from the PTF container: And with such config we have always only part of neighbors resolved (always the same): Just a guess, It could be that in ARP responder script, when it reads config file, first neighbors are stored for some port and if then we got some new neighbors for this port they are just overrided with the latest ones and as a result we lose previous entries. |
|
Hi, |
|
Now it works, thanks |
…ance submodule head (sonic-net#14029) utilities: * a4f141f1 2023-01-10 | [sfputil] Firmware download/upgrade CLI support for QSFP-DD (sonic-net#1947) (sonic-net#2349) (HEAD -> 202205) [CliveNi] swss-common: * 41fcad8 2023-01-30 | Increase the netlink buffer size from 3MB to 16MB. (sonic-net#739) (HEAD -> 202205) [KISHORE KUNAL] sairedis: * 5ce9990 2023-02-27 | [Dual-ToR] update sai.profile with SAI_ADDITIONAL_MAC_ENABLED attribute if corresponding arg passed to syncd (sonic-net#1201) (HEAD -> 202205) [Andriy Yurkiv] * 3c2e0c5 2023-02-23 | Use new value of STATE_DB FAST_REBOOT entry (sonic-net#1196) [Aryeh Feigin] * fe7756f 2023-02-28 | [submodule][SAI]Advance SAI head (sonic-net#1210) (github/202205) [Richard.Yu] platform-common: * 321a8e7 2022-09-23 | Cdb fw upgrade (sonic-net#308) (HEAD -> 202205) [CliveNi] swss: * ceea558 2023-02-28 | [orchagent]: Get bridge port ID from orchagent cache instead of SAI API (sonic-net#2657) (HEAD -> 202205) [Lawrence Lee] * bd04e24 2023-03-01 | [dualtor] Fix neighbor miss when mux is not ready (sonic-net#2676) (HEAD -> 202205) [Longxiang Lyu] * 7d87a90 2023-02-28 | [ci] Fix pipeline error about team5 not found. (sonic-net#2684) [Liu Shilong] * 93a924c 2023-02-27 | [aclorch] Fixed issue sonic-net#2204.Support IN_PORTS qualifer in MIRRORV6 table. (sonic-net#2668) [Rajkumar-Marvell] * 9d87ec4 2023-02-23 | swss: Fix Invalid port oid messages generated because of voq counters. (sonic-net#2653) [Sambath Kumar Balasubramanian] Signed-off-by: Ying Xie <ying.xie@microsoft.com>
Why I did it cf9a66b - Fix issue: bulk counter feature is disabled ([Broadcom]: Update Broadcom SDK/SAI package sonic-net#1205) (4 hours ago) [Lior Avramov] 8b1583b - [Dual-ToR] update sai.profile with SAI_ADDITIONAL_MAC_ENABLED attribute if corresponding arg passed to syncd ([Makefile]: variable ENABLE_SYNCD_RPC is always empty string sonic-net#1201) (4 hours ago) [Andriy Yurkiv] 50d8e21 - [syncd]: Enable port bulk API ([platform] Accton AS7712-32X. Update for sensors and sfputil. sonic-net#1197) (4 hours ago) [Nazarii Hnydyn] a72438a - Use new value of STATE_DB FAST_REBOOT entry ([device/accton]: Update Accton-AS5712_54X sonic-net#1196) (4 hours ago) [Aryeh Feigin] d78ce86 - validation support for SAI_ATTR_VALUE_TYPE_JSON ([installer] FIX. ONIE installer error issue: sonic-net#1152) (4 hours ago) [svshah-intel] How I did it How to verify it
Fixes based on UT
Description of PR
Summary:
Updated arp responder.py to use libpcap socket as low level l2caplisten socket so that arp_responder gets vlan tag from the packet.
The vlan tag is then used in the arp response.
With this change an interface can have multiple vlans. Earlier there was one vlan per interface which is picked from /tmp/from_t1.json
PLEASE DO NOT MERGE THIS UNTIL sonic-net/sonic-buildimage#3731 is merged
Fixes # (issue)
Type of change
Approach
How did you do it?
Updated docker-ptf to include python-libpcap.
After setting conf.use_pcap = True
print the value of conf.L2listen
and the value is
<L2pcapListenSocket: read packets at layer 2 using libpcap>
Without the configuration the value printed would be
<L2ListenSocket: read packets at layer 2 using Linux PF_PACKET sockets>
Use scapy send and recv instead of traditional socket send and recv API calls.
How did you verify/test it?
After this change verify by running existing test cases. All the test cases that uses arp_responder.py passed.
Additional ran the script separately to ensure vlan tag is received in a packet during arp request.
Below is the sample received packet
ffffffffffff4c7625f446808100000a080600010800060400014c7625f446800101010100000000000001010103
The packet was sent on vlan 10 and "8100 000a" confirms vlan 10 is present in packet received.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation