Skip to content

Interfaces / ARP - add new facility to register static entries #6917

Description

@AdSchellevis

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

Currently it's only possible to define static arp entries when a dhcp server is being used, it would be practical to have a core facility that offers access to static arp entries for non-dhcp cases as well.

Describe the solution you like

A generic facility similar to how Aliases are being handled which offers easy to access manual assignments, which can also be used by other components if they want to register static entries.

Describe alternatives you considered

Reuse the dhcp static assignments, which should at some point also be migrated (to kea?) with the eol notice of isc-dhcp. If we can "plug" entries, it should also be easy to show the current entries from dhcpd in the same area.

Additional context

Relevant current code paths:

interfaces_staticarp_configure($dhcpif, $ifconfig_details);

function interfaces_staticarp_configure($if, $ifconfig_details = null)
{
global $config;
$ifcfg = $config['interfaces'][$if];
if (empty($ifcfg['if']) || !isset($ifcfg['enable'])) {
return;
}
if (empty($ifconfig_details)) {
$ifconfig_details = legacy_interfaces_details($ifcfg['if']);
}
if (empty($ifconfig_details[$ifcfg['if']])) {
return;
}
$have = in_array('staticarp', $ifconfig_details[$ifcfg['if']]['flags']);
$want = isset($config['dhcpd'][$if]['staticarp']);
if ($have !== $want) {
mwexecf('/sbin/ifconfig %s %sstaticarp', [$ifcfg['if'], $want ? '' : '-']);
mwexecf('/usr/sbin/arp -d -i %s -a', [$ifcfg['if']]);
}
if (isset($config['dhcpd'][$if]['staticmap'])) {
foreach ($config['dhcpd'][$if]['staticmap'] as $arpent) {
if (!$want && !isset($arpent['arp_table_static_entry'])) {
continue;
}
if (!isset($arpent['ipaddr'])) {
continue;
}
mwexecf('/usr/sbin/arp -s %s %s', [$arpent['ipaddr'], $arpent['mac']]);
}
}
}

Activity

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

Metadata

Metadata

Assignees

Labels

featureAdding new functionality

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions