Skip to content

Conversation

cblackburn-igl
Copy link
Contributor

Change summary

This commit adds support in both the CLI and the underlying code for DHCP Option 82 to be used to filter/route DHCP address assignments.

The primary use case for this is to support enterprise switches which can "tag" DHCP requests with physical real world information such as which switch first saw the request and which port it originated from (known in this context as remote-id and circuit-id). Once client-classes have been defined they can be assigned to subnets or ranges so that only certain addresses get assigned to specific requests.

There is also a corresponding documentation update which pairs with this code change.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

https://vyos.dev/T3936

Related PR(s)

vyos/vyos-documentation#1666

How to test / Smoketest result

I have tested these changes by adding new smoketests into the pre existing smoketest file. These new tests specifically check the new functionality including verifying that the generated config files are as expected and that the CLI refuses to take an incorrect commit.

I have also done integration testing in our lab which is set up with a switch which injects DHCP Option 82 information into live DHCP requests and these are processed as expected by VyOS.

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

This commit adds support in both the CLI and the underlying code for
DHCP Option 82 to be used to filter/route DHCP address assignments.

The primary use case for this is to support enterprise switches which
can "tag" DHCP requests with physical real world informaiton such as
which switch first saw the request and which port it originated from
(known in this context as remote-id and circuit-id). Once
client-classes have been defined they can be assigned to subnets or
ranges so that only certain addresses get assigned to specific
requests.

There is also a corresponding documentation update which pairs with
this code change.
Copy link

github-actions bot commented Aug 10, 2025


PR title does not match the required format

Comment on lines 454 to 460
inet,
ip_address,
host_name=None,
mac_address=None,
iaid=None,
duid=None,
subnet_id=None,
Copy link
Member

Choose a reason for hiding this comment

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

Why did you touch this code?
The indents were correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I honestly didn't mean to. It must have been done automatically by the autoformatter. I can't remember using it but I must have out of muscle memory. I'll see if I can work out how to undo it in the PR. I might have to cancel and resubmit.

Comment on lines 656 to 659
data_lease['remaining'] != ''
and data_lease['pool'] in pools
and data_lease['state'] != 'free'
and (not state or state == 'all' or data_lease['state'] in state)
Copy link
Member

Choose a reason for hiding this comment

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

Why did you touch this code?
The indents were correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I honestly didn't mean to. It must have been done automatically by the autoformatter. I can't remember using it but I must have out of muscle memory. I'll see if I can work out how to undo it in the PR. I might have to cancel and resubmit.

@sever-sever sever-sever requested review from dmbaturin and c-po August 11, 2025 09:10
Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

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

The CLI and the implementation look fine, just don't mix formatting changes with new logic. I also suggested some improvements in the CLI help.

<children>
<leafNode name="circuit-id">
<properties>
<help>Filters on the contents of the circuit-id sub option. Assumes ASCII text unless input starts with 0x in which case it is interpreted as raw hex</help>
Copy link
Member

Choose a reason for hiding this comment

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

This help string is way too long. To let the user know that both text and hex values are accepted, I'd use <valueHelp> tags like in here in VRRP.

</leafNode>
<leafNode name="remote-id">
<properties>
<help>Filters on the contents of the remote-id sub option. Assumes ASCII text unless input starts with 0x in which case it is interpreted as raw hex</help>
Copy link
Member

Choose a reason for hiding this comment

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

Same issue as above — a very long string that should be split into a short help string and value help items.


return out


Copy link
Member

Choose a reason for hiding this comment

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

To add to @sever-sever's review: please do not mix new logic and formatting changes.

This commit adds support in both the CLI and the underlying code for
DHCP Option 82 to be used to filter/route DHCP address assignments.

The primary use case for this is to support enterprise switches which
can "tag" DHCP requests with physical real world informaiton such as
which switch first saw the request and which port it originated from
(known in this context as remote-id and circuit-id). Once
client-classes have been defined they can be assigned to subnets or
ranges so that only certain addresses get assigned to specific
requests.

There is also a corresponding documentation update which pairs with
this code change.

Co-Authored-By: Daniil Baturin <[email protected]>
@cblackburn-igl cblackburn-igl force-pushed the origin/T3936-DHCP-Option-82-Support branch from aeb5878 to 59b9ceb Compare August 11, 2025 13:23
@Apachez-
Copy link
Contributor

Why is this line included, I mean what is the purpose?

from operator import truediv

…ort' into origin/T3936-DHCP-Option-82-Support

# Conflicts:
#	interface-definitions/service_dhcp-server.xml.in
This reverts commit 59b9ceb.

Reapply "dhcp-server: T3936: Added support for DHCP Option 82"

This reverts commit ada0c80.

Fixes from PR

Fixes from PR

Fixes from PR
@cblackburn-igl cblackburn-igl force-pushed the origin/T3936-DHCP-Option-82-Support branch from 7dae904 to 487d5fe Compare August 17, 2025 15:44
@cblackburn-igl
Copy link
Contributor Author

ok, despite wrestling for hours with Git I can't find a way to rebase this PR down into a single commit now because it contains a merge. I'm going to have to close and abandon this pull request and recreae in a new branch which is squashed down to one commit. I will then create a new pull request

@cblackburn-igl cblackburn-igl deleted the origin/T3936-DHCP-Option-82-Support branch August 17, 2025 16:16
Copy link

CI integration 👍 passed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

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

Successfully merging this pull request may close these issues.

4 participants