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

[DHCPv6 Relay] [202106] Fix kernel memory allocation, log verbosity and dhcpmon bugs #8975

Merged
merged 4 commits into from
Oct 19, 2021
Merged

[DHCPv6 Relay] [202106] Fix kernel memory allocation, log verbosity and dhcpmon bugs #8975

merged 4 commits into from
Oct 19, 2021

Conversation

shlomibitton
Copy link
Contributor

@shlomibitton shlomibitton commented Oct 14, 2021

Why I did it

This PR fix 2 issues for DHCPv6 relay.

  1. Kernel socket memory allocation size is too small for 'setsockopt', causing an exception and crashing the DHCPv6 daemon:
    setsockopt: IPV6_JOIN_GROUP: Cannot allocate memory
    To fix it, the memory size for sockets has been enlarged to 40960.

  2. By design, the DHCPv6 relay will start while considering all L3 interfaces as up link interfaces.
    When a DHCPv6 packet get to the CPU the relay will try to transmit it to all up link interfaces.
    This can lead to ERROR messages in the log: "ERR dhcp_relay#dhcrelay[40]: send_packet6: Network is unreachable" as there is no route to the DHCP server from all up link interfaces.
    Thus, changing the verbosity is required for not to alert unnecessary ERROR messages in syslog.

  3. Fix 'dhcpmon', exclude incrementing the aggregate device if packets received on the MGMT interface.
    The MGMT is incremented to check if DHCP packets are traveling through MGMT interface, it is not part of the aggregate device counters.
    To allow checking the MGMT interface health as well, we need to check the counters of MGMT interface also, so in function 'dhcp_device_check_health' we need to check the current device counters, not only the aggregate device.

  4. Fix 'dhcpmon' DHCP header offset calculation.
    Get the correct option ID in order to get the inner DHCP message.

How I did it

  1. Change net.core.optmem_max=40960.
  2. Change verbosity level.
  3. Exclude MGMT from aggregated device.
  4. Fix DHCP header offset calculation.

How to verify it

Configure DHCPv6 relay.

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

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106

Description for the changelog

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

Shlomi Bitton added 2 commits October 13, 2021 10:30
…cate memory' issue

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
Change the verbosity level from ERROR to INFO for returned code of 'Network is unreachable' when sending packets.
This is because by design, the relay will try to relay packets to all DHCP servers even if there is no route to it and then the error message will print out.

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
Shlomi Bitton added 2 commits October 15, 2021 10:41
…MGMT interface.

The MGMT is incremented to check if DHCP packets are traveling through mgmt interface, it is not part of the aggregate device counters.
To allow checking the MGMT interface health as well, we need to check the counters of MGMT interface also, so on function 'dhcp_device_check_health' we need to check the current device counters, not only the aggregate device.

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
Get the correct option ID in order to get the inner DHCP message

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
@shlomibitton shlomibitton changed the title [DHCPv6 Relay] [202106] Fix kernel memory allocation issue and log verbosity for unreachable network [DHCPv6 Relay] [202106] Fix kernel memory allocation, log verbosity and dhcpmon bugs Oct 17, 2021
@shlomibitton
Copy link
Contributor Author

@tahmed-dev can you please review?

@liat-grozovik
Copy link
Collaborator

@tahmed-dev could you please help to review?

@tahmed-dev
Copy link
Contributor

@tahmed-dev can you please review?

@kellyyeh can you please review as I do not have access anymore?

@shlomibitton
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kellyyeh kellyyeh self-requested a review October 18, 2021 17:54
@kellyyeh kellyyeh merged commit 60c9c0b into sonic-net:202106 Oct 19, 2021
This was referenced Oct 19, 2021
@shlomibitton shlomibitton deleted the shlomi_dhcp6_relay_fixes branch March 15, 2022 09:59
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