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

SwSS Changes for DHCP DoS Mitigation Feature #3130

Open
wants to merge 170 commits into
base: master
Choose a base branch
from

Conversation

asraza07
Copy link

@asraza07 asraza07 commented May 2, 2024

What I did
Added support for DHCP DoS Mitigation feature via kernel through PortMgrd
Why I did it
DHCP Mitigation Rate attribute added to config_db needed a path to appl_db and kernel configurations. This was done through PortMgrd

@asraza07 asraza07 changed the title Support for DHCP DoS Mitigation feature SwSS Chnages for DHCP DoS Mitigation Feature May 6, 2024
@asraza07 asraza07 marked this pull request as ready for review May 6, 2024 07:01
@asraza07 asraza07 requested a review from prsunny as a code owner May 6, 2024 07:01
@asraza07 asraza07 changed the title SwSS Chnages for DHCP DoS Mitigation Feature SwSS Changes for DHCP DoS Mitigation Feature May 7, 2024
@ridahanif96
Copy link
Contributor

@Yarden-Z Hi Yarden, Can you please help review this code. Thanks in advance!

@muhammadalihussnain muhammadalihussnain force-pushed the dhcp_dos_mitigation_swss branch from b761b27 to d22882a Compare May 16, 2024 10:17
@@ -231,7 +231,7 @@ def __init__(self, ctn_name: str, pid: int, i: int):
# bring up link in the virtual switch
ensure_system(f"nsenter -t {pid} -n ip link set dev {self.pifname} up")

# disable arp, so no neigh on physical interfaces
# disable arp, so no neigh on physical interfaces0 / 21 files viewed
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is not right. Please fix

Choose a reason for hiding this comment

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

fixed

Choose a reason for hiding this comment

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

fixed

@@ -1432,7 +1432,7 @@ def get_state_db(self) -> DVSDatabase:
return self.state_db

def change_port_breakout_mode(self, intf_name, target_mode, options=""):
cmd = f"config interface breakout {intf_name} {target_mode} -y {options}"
cmd = f"config interface breakout {intf_name} {target_mode} -y {options}"py
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the additional "py" at the end?

Choose a reason for hiding this comment

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

this py was added mistakenly

@@ -146,7 +146,7 @@ def wait_for_entry(
"""Wait for the entry stored at `key` in the specified table to exist and retrieve it.

Args:
table_name: The name of the table where the entry is stored.
table_name: The name of the table where theentry is stored.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix stray characters

Choose a reason for hiding this comment

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

Fixed

@@ -251,7 +248,7 @@ def access_function():

return result

def wait_for_field_negative_match(
def wait_for_field_negative_match(
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix stray characters

Choose a reason for hiding this comment

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

fixed

@@ -220,7 +220,7 @@ def test_PortInterfaceAddRemoveIpv6Address(self, dvs, testlog):
if route["dest"] == "fc00::/126":
assert False
if route["dest"] == "fc00::1/128":
assert False
assert False
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix trailing whitespaces

Choose a reason for hiding this comment

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

fixed

else if (fvField(i) == "admin_status")
{
admin_status = fvValue(i);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix trailing spaces

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@prabhataravind prabhataravind left a comment

Choose a reason for hiding this comment

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

There are still many places with incorrect formatting and stray characters. Please review everything and confirm everything looks correct before you post the changes to be reviewed again.

Copy link
Contributor

@prabhataravind prabhataravind left a comment

Choose a reason for hiding this comment

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

The latest set of changes lgtm. This branch seems to be out-of-date with master. Could you please fix? Once done, please request @prsunny to help merge if there are no other concerns.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@muhammadalihussnain
Copy link

@prsunny , PR has been approved. Please help to merge code PR. Thanks in advance

@ridahanif96
Copy link
Contributor

@prsunny please help merge this PR, pending for long!Thanks!

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

Commenter does not have sufficient privileges for PR 3130 in repo sonic-net/sonic-swss

1 similar comment
Copy link

Commenter does not have sufficient privileges for PR 3130 in repo sonic-net/sonic-swss

@prsunny
Copy link
Collaborator

prsunny commented Dec 19, 2024

@asraza07 , can you resolve conflicts? Also Please provide the merge sequence. Does this PR has any dependency on sonic-buildimage PR.

}
if (!dhcp_rate_limit.empty())
{
setPortDHCPMitigationRate(alias, dhcp_rate_limit);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be set only if there is explicit configuration of dhcp_rate_limit. It should stay the same as today (no kernel TC) if there is no config.

@@ -283,6 +284,7 @@ def create_interface_n_fg_ecmp_config(dvs, nh_range_start, nh_range_end, fg_nhg_
dvs.port_admin_set(if_name_key, "up")
shutdown_link(dvs, app_db, i)
startup_link(dvs, app_db, i)
time.sleep(5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please don't change any tests not part of this feature

@@ -2293,4 +2299,4 @@ def test_portChannelInterfaceLoopbackActionForward(self, dvs, testlog):
# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Revert non relevant changes.

# try to remove this port
config_db.delete_entry('PORT', PORT_A)
num = asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT",
num_of_ports-1,
polling_config = PollingConfig(polling_interval = 1, timeout = 5.00, strict = True))
polling_config = PollingConfig(polling_interval = 1, timeout = 10.00, strict = True))
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this change for?

Copy link
Contributor

@prabhataravind prabhataravind left a comment

Choose a reason for hiding this comment

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

Please fix Prince's comment about calling setPortDHCPMitigationRate when there is no explicit configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants