Skip to content

Revert "DHCP DoS Logger for DHCP DoS Mitigation Feature (#18947)"#22831

Merged
StormLiangMS merged 1 commit intosonic-net:masterfrom
yaqiangz:master_revert
Jun 3, 2025
Merged

Revert "DHCP DoS Logger for DHCP DoS Mitigation Feature (#18947)"#22831
StormLiangMS merged 1 commit intosonic-net:masterfrom
yaqiangz:master_revert

Conversation

@yaqiangz
Copy link
Contributor

@yaqiangz yaqiangz commented Jun 3, 2025

This reverts commit b00a8d6.

Why I did it

Revert PR #18947 because below 2 issues, it would block PR check

  1. dhcp_dos_logger fail to start due to permission issue
admin@sonic:/usr/lib/systemd/system$ sudo systemctl status dhcp_dos_logger.service
× dhcp_dos_logger.service - Log DHCP rate limit violations
     Loaded: loaded (/lib/systemd/system/dhcp_dos_logger.service; enabled-runtime; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2025-06-03 05:26:49 UTC; 4s ago
   Duration: 1ms
    Process: 9932 ExecStart=/usr/bin/dhcp_dos_logger.py (code=exited, status=203/EXEC)
   Main PID: 9932 (code=exited, status=203/EXEC)

Jun 03 05:26:49 sonic systemd[1]: Started dhcp_dos_logger.service - Log DHCP rate limit violations.
Jun 03 05:26:49 sonic (ogger.py)[9932]: dhcp_dos_logger.service: Failed to locate executable /usr/bin/dhcp_dos_logger.py: Permission denied
Jun 03 05:26:49 sonic (ogger.py)[9932]: dhcp_dos_logger.service: Failed at step EXEC spawning /usr/bin/dhcp_dos_logger.py: Permission denied
Jun 03 05:26:49 sonic systemd[1]: dhcp_dos_logger.service: Main process exited, code=exited, status=203/EXEC
Jun 03 05:26:49 sonic systemd[1]: dhcp_dos_logger.service: Failed with result 'exit-code'.
  1. Even if grant permission to this file, it would still fail with below error
admin@sonic:/usr/bin$ sudo chmod 755 dhcp_dos_logger.py 
admin@sonic:/usr/bin$
admin@sonic:/usr/bin$ sudo systemctl restart dhcp_dos_logger.service 
admin@sonic:/usr/bin$ sudo systemctl status dhcp_dos_logger.service 
× dhcp_dos_logger.service - Log DHCP rate limit violations
     Loaded: loaded (/lib/systemd/system/dhcp_dos_logger.service; enabled-runtime; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2025-06-03 05:29:38 UTC; 4s ago
   Duration: 85ms
    Process: 11312 ExecStart=/usr/bin/dhcp_dos_logger.py (code=exited, status=1/FAILURE)
   Main PID: 11312 (code=exited, status=1/FAILURE)

Jun 03 05:29:38 sonic dhcp_dos_logger.py[11312]:     handler()
Jun 03 05:29:38 sonic dhcp_dos_logger.py[11312]:   File "/usr/bin/dhcp_dos_logger.py", line 39, in handler
Jun 03 05:29:38 sonic dhcp_dos_logger.py[11312]:     match = re.search(r'dropped (\d+)', output.stdout)
Jun 03 05:29:38 sonic dhcp_dos_logger.py[11312]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 03 05:29:38 sonic dhcp_dos_logger.py[11312]:   File "/usr/lib/python3.11/re/__init__.py", line 176, in search
Jun 03 05:29:38 sonic dhcp_dos_logger.py[11312]:     return _compile(pattern, flags).search(string)
Jun 03 05:29:38 sonic dhcp_dos_logger.py[11312]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 03 05:29:38 sonic dhcp_dos_logger.py[11312]: TypeError: cannot use a string pattern on a bytes-like object
Jun 03 05:29:38 sonic systemd[1]: dhcp_dos_logger.service: Main process exited, code=exited, status=1/FAILURE
Jun 03 05:29:38 sonic systemd[1]: dhcp_dos_logger.service: Failed with result 'exit-code'.
admin@sonic:/usr/bin$ 
Work item tracking
  • Microsoft ADO (number only):

How I did it

Revert PR

How to verify it

Which release branch to backport (provide reason below if selected)

  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

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

@yaqiangz yaqiangz requested a review from lguohan as a code owner June 3, 2025 06:29
@yaqiangz
Copy link
Contributor Author

yaqiangz commented Jun 3, 2025

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

LGTM

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.

6 participants