Skip to content

Dhcp relay agent - #1820

Draft
troglobit wants to merge 10 commits into
mainfrom
dhcp-relay
Draft

troglobit wants to merge 10 commits into
mainfrom
dhcp-relay

Conversation

@troglobit

Copy link
Copy Markdown
Contributor

Description

wip

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

DHCP relay agent with option 82, for an IP address per port on a
switch.  Installed as an available Finit service, to be enabled when a
relay is configured.

Enabled in all defconfigs that have the DHCP server.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A node with a when expression that refers to another subtree was never
offered for completion, e.g. a list that only applies when the
interface its parent names is a bridge.  Bump klish-plugin-sysrepo,
which now evaluates the expression against the candidate datastore.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The address of a static host is not used while another client has a
lease on it.  With a host that matches on the port a client is
connected to, option 82, a device that replaces a broken one does not
get the address of the port until the lease of the old device expires.

With preempt on the dhcp-host the new client takes over the address at
once.  Issue #705

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
dnsmasq binds UDP port 67 on the wildcard address without allowing
another socket on the port, so a relay agent on the same system cannot
bind it on its gateway addresses.  With bind-dynamic it can.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A subnet in the DHCP server without a pool, only static hosts, was not
served at all: no client got an address from it.  The model allows it,
and it is the natural setup when every address is reserved.

dnsmasq only serves a subnet it has a dhcp-range for, and the range was
written from the pool.  Write a static range for a subnet without one.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A static host in the DHCP server can be matched on MAC address,
hostname or client-id, all of which follow the device.  With a DHCP
relay agent that adds option 82, the server can instead hand out an
address per port, whatever is connected to it.

Add an option82 case to the host match, with circuit-id and remote-id
as string or hex, and a preempt setting, which lets a device that
replaces a broken one take over the address before the old lease has
expired.  Issue #705

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Brings what the relay agent needs to run under confd: it waits for
interfaces and addresses that are not there yet, can turn off option 82
per interface, and relays from trunk ports in each of their VLANs.  It
also fixes relaying with the server on the same subnet as the clients.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Clients cannot get an address from a DHCP server on another subnet, and
a server cannot hand out an address per port, without a relay agent
that tells it where a request came from, option 82.

Add the infix-dhcp-relay model and generate the configuration for
dhcprelayd from it.  An interface that is a bridge, or a VLAN interface
on a bridge, relays per bridge port: all ports of a bridge, or the
ports with the VLAN as PVID and its tagged members.  The port list of
an interface only holds the exceptions: a port that should not relay,
a trusted port towards another relay agent, or a circuit-id other than
the port name.

For a server on the device itself, at 127.0.0.1, the server identifier
override is always on, or the clients would be told that their server
is 127.0.0.1.

Fixes #438

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Five tests, one for each way the relay agent is meant to be used: to a
server on another subnet, to a server on the device itself with a
replaced client, from an interface that is not a bridge without option
82, in a chain of two switches where the first gets its own address
through the second, and on a VLAN filtering bridge with an access port
and a trunk port.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>

This branch has not been deployed

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant