Skip to content
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

[dhcpmon] Filter DHCP O/A Messages of Neighboring Vlans #4469

Merged

Conversation

tahmed-dev
Copy link
Contributor

@tahmed-dev tahmed-dev commented Apr 23, 2020

- Why I did it

  1. This code fixes a bug where two or more vlans exist. Cross contamination
    happens for DHCP packets Offer/Ack when received on shared northbound links.
    The code filters out those packet based on dst IP equal Vlan loopback IP.

  2. Also, Fixed a bug where libevent event id was being printed instead of signal id.

signed-off-by: Tamer Ahmed [email protected]

- How to verify it
pytest test_dhcp_relay.py --testbed=testbed --inventory=../ansible/str --testbed_file=../ansible/testbed.csv --host-pattern=all --module-path=../ansible/library

***-Using single Vlan
logs from syslog:
Apr 23 04:52:59.710434 str-s6100-acs-2 NOTICE dhcp_relay#dhcpmon[52]: DHCP Discover rx: 2, tx:96, Offer rx: 2, tx:2, Request rx: 2, tx:96, ACK rx: 2, tx:2

Apr 23 04:54:25.390030 str-s6100-acs-2 NOTICE dhcp_relay#dhcpmon[51]: DHCP Discover rx: 1, tx:48, Offer rx: 1, tx:1, Request rx: 1, tx:48, ACK rx: 1, tx:1

***-Using two vlans:
ansible-playbook config_sonic_basedon_testbed.yml -i str -l str-s6100-acs-2 -e testbed_name=vms7-t0-s6100 --vault-password-file=../.vault-file -e deploy=true -e vlan_config=two_vlan_a

Apr 23 08:05:35.444937 str-s6100-acs-2 ALERT dhcp_relay#dhcpmon[58]: Received signal Terminated
Apr 23 08:05:35.444937 str-s6100-acs-2 NOTICE dhcp_relay#dhcpmon[58]: DHCP Discover rx: 2, tx:96, Offer rx: 2, tx:2, Request rx: 2, tx:96, ACK rx: 2, tx:2
Apr 23 08:05:35.444937 str-s6100-acs-2 ALERT dhcp_relay#dhcpmon[57]: Received signal Terminated
Apr 23 08:05:35.444937 str-s6100-acs-2 NOTICE dhcp_relay#dhcpmon[57]: DHCP Discover rx: 2, tx:96, Offer rx: 2, tx:2, Request rx: 2, tx:96, ACK rx: 2, tx:2

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

This code fixes a bug where two or more vlans exist. Cross contamination
happens for DHCP packets Offer/Ack when received on shared northbound links.
The code filters out those packet based on dst IP equal Vlan loopback IP.

signed-off-by: Tamer Ahmed <[email protected]>
@tahmed-dev tahmed-dev requested a review from lguohan April 23, 2020 21:56
jleveque
jleveque previously approved these changes Apr 28, 2020
Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add comments into the function?

src/dhcpmon/src/dhcp_device.c Show resolved Hide resolved
pavel-shirshov
pavel-shirshov previously approved these changes Apr 28, 2020
pavel-shirshov
pavel-shirshov previously approved these changes Apr 28, 2020
Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

jleveque
jleveque previously approved these changes Apr 28, 2020
Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with minor suggestion.

src/dhcpmon/src/dhcp_device.c Outdated Show resolved Hide resolved
@tahmed-dev tahmed-dev merged commit a60a203 into sonic-net:master Apr 28, 2020
yxieca pushed a commit that referenced this pull request Apr 28, 2020
* [dhcpmon] Filter DHCP O/A Messages of Neighboring Vlans

This code fixes a bug where two or more vlans exist. Cross contamination
happens for DHCP packets Offer/Ack when received on shared northbound links.
The code filters out those packet based on dst IP equal Vlan loopback IP.

signed-off-by: Tamer Ahmed <[email protected]>
abdosi pushed a commit that referenced this pull request May 1, 2020
* [dhcpmon] Filter DHCP O/A Messages of Neighboring Vlans

This code fixes a bug where two or more vlans exist. Cross contamination
happens for DHCP packets Offer/Ack when received on shared northbound links.
The code filters out those packet based on dst IP equal Vlan loopback IP.

signed-off-by: Tamer Ahmed <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants