Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@
{
"name": "radio0",
"class": "infix-hardware:wifi",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"band": "2.4GHz",
"channel": "auto"
}
},
{
"name": "radio1",
"class": "infix-hardware:wifi",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"band": "2.4GHz",
"channel": "auto"
}
},
{
"name": "radio1",
"class": "infix-hardware:wifi",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"band": "5GHz",
"channel": "auto"
}
}
}
]
},
"ietf-interfaces:interfaces": {
Expand Down Expand Up @@ -130,7 +130,8 @@
"id": "domain"
},
{
"id": "hostname"
"id": "hostname",
"value": "auto"
},
{
"id": "dns-server"
Expand Down Expand Up @@ -179,7 +180,7 @@
}
}
},
"infix-interfaces:bridge-port": {
"infix-interfaces:bridge-port": {
"bridge": "br0"
}
},
Expand All @@ -195,7 +196,7 @@
}
}
},
"infix-interfaces:bridge-port": {
"infix-interfaces:bridge-port": {
"bridge": "br0"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@
{
"name": "radio0",
"class": "infix-hardware:wifi",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"band": "2.4GHz",
"channel": "auto"
}
},
{
"name": "radio1",
"class": "infix-hardware:wifi",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"band": "2.4GHz",
"channel": "auto"
}
},
{
"name": "radio1",
"class": "infix-hardware:wifi",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"band": "5GHz",
"channel": "auto"
}
}
}
]
},
"ietf-interfaces:interfaces": {
Expand Down Expand Up @@ -96,7 +96,8 @@
"id": "domain"
},
{
"id": "hostname"
"id": "hostname",
"value": "auto"
},
{
"id": "dns-server"
Expand Down Expand Up @@ -145,7 +146,7 @@
}
}
},
"infix-interfaces:bridge-port": {
"infix-interfaces:bridge-port": {
"bridge": "br0"
}
},
Expand All @@ -161,7 +162,7 @@
}
}
},
"infix-interfaces:bridge-port": {
"infix-interfaces:bridge-port": {
"bridge": "br0"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
{
"name": "radio0",
"class": "infix-hardware:wifi",
"infix-hardware:wifi-radio": {
"country-code": "DE",
"band": "2.4GHz",
"channel": "auto"
}
"infix-hardware:wifi-radio": {
"country-code": "DE",
"band": "2.4GHz",
"channel": "auto"
}
}
]
},
Expand Down Expand Up @@ -104,7 +104,8 @@
"id": "domain"
},
{
"id": "hostname"
"id": "hostname",
"value": "auto"
},
{
"id": "dns-server"
Expand Down Expand Up @@ -153,7 +154,7 @@
}
}
},
"infix-interfaces:bridge-port": {
"infix-interfaces:bridge-port": {
"bridge": "br0"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"id": "domain"
},
{
"id": "hostname"
"id": "hostname",
"value": "auto"
},
{
"id": "dns-server"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
"id": "domain"
},
{
"id": "hostname"
"id": "hostname",
"value": "auto"
},
{
"id": "dns-server"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"id": "domain"
},
{
"id": "hostname"
"id": "hostname",
"value": "auto"
},
{
"id": "dns-server"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"id": "domain"
},
{
"id": "hostname"
"id": "hostname",
"value": "auto"
},
{
"id": "dns-server"
Expand Down
3 changes: 1 addition & 2 deletions board/common/rootfs/etc/dnsmasq.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# managed by openresolv. DHCP lease, VPN tunnel establishment,
# and similar events feed servers and configuration to dnsmasq.
domain-needed
dhcp-authoritative

# Allow configuration and cache clear over D-Bus
enable-dbus
Expand All @@ -10,8 +11,6 @@ enable-dbus
#dhcp-option=option:netmask
#dhcp-option=28 # option:broadcast
#dhcp-option=option:domain-name
dhcp-option=option:router
dhcp-option=option:dns-server
dhcp-option=12 # option:hostname

# Generated by openresolv
Expand Down
Empty file.
6 changes: 1 addition & 5 deletions board/common/rootfs/usr/share/udhcpc/default.script
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACTION="$1"
IP_CACHE="/var/lib/misc/${interface}.cache"
RESOLV_CONF="/run/resolvconf/interfaces/${interface}.conf"
NTPFILE="/run/chrony/dhcp-sources.d/${interface}.sources"
NAME="/etc/netd/conf.d/${interface}-dhcp.conf"
NAME="/etc/net.d/${interface}-dhcp.conf"
NEXT="${NAME}+"

[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
Expand Down Expand Up @@ -118,17 +118,13 @@ set_dhcp_routes()
# Reduce changes needed by comparing with previous route(s)
cmp -s "$NAME" "$NEXT" && return
mv "$NEXT" "$NAME"

initctl reload netd
}

clr_dhcp_routes()
{
log "deleting DHCP routes"
[ -f "$NAME" ] || return
rm "$NAME"

initctl reload netd
}

clr_dhcp_addresses()
Expand Down
12 changes: 12 additions & 0 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ All notable changes to the project are documented in this file.

### Fixes

- Fix #1438: default route from DHCP client not set at boot, regression
introduced in v26.02.0
- Fix DHCP client not sending hostname to server (e.g. for `dnsmasq` lease
registration). All board factory configs had the hostname option without
`value: auto`, so `udhcpc` only requested the option instead of sending it.
Setting up a DHCP client manually was not affected. Also, the hostname
format string (e.g. `rpi-%m`) was not expanded to the actual system hostname
before being passed to `udhcpc`
- Fix dnsmasq logging spurious "Ignoring duplicate dhcp-option" warnings for
options 3 (router) and 6 (dns-server) on every DHCP transaction. Add
`dhcp-authoritative` so clients with unexpired leases are not NAKed after
a router crash or factory reset that clears the lease database
- Fix #1387: `infix.local` now resolves to exactly one device per LAN. Previously
all Infix devices claimed both `hostname.local` and `infix.local`, causing avahi
to append `#2`, `#3` suffixes to the shared alias on busy networks. Assignment
Expand Down
3 changes: 2 additions & 1 deletion package/netd/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ config BR2_PACKAGE_NETD
bool "netd"
select BR2_PACKAGE_LIBITE
select BR2_PACKAGE_LIBCONFUSE
select BR2_PACKAGE_LIBEV
help
Network route daemon. Manages static routes and RIP routing.
Reads configuration from /etc/netd/conf.d/*.conf.
Reads configuration from /etc/net.d/*.conf.

With FRR: Full routing via gRPC, vtysh, or frr.conf.
Without FRR: Standalone Linux backend via rtnetlink.
Expand Down
4 changes: 2 additions & 2 deletions package/netd/netd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#
################################################################################

NETD_VERSION = 1.0
NETD_VERSION = 1.1.0
NETD_SITE_METHOD = local
NETD_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/netd
NETD_LICENSE = BSD-3-Clause
NETD_LICENSE_FILES = LICENSE
NETD_REDISTRIBUTE = NO
NETD_DEPENDENCIES = libite libconfuse jansson
NETD_DEPENDENCIES = libite libconfuse jansson libev
NETD_AUTORECONF = YES

NETD_CONF_ENV = CFLAGS="$(INFIX_CFLAGS)"
Expand Down
20 changes: 11 additions & 9 deletions src/confd/src/dhcp-common.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause */

#include <ctype.h>
#include <limits.h>
#include <pwd.h>
#include <sys/utsname.h>
#include <sys/sysinfo.h>
Expand Down Expand Up @@ -70,21 +71,20 @@ int dhcp_option_lookup(const struct lyd_node *id)

char *dhcp_hostname(struct lyd_node *cfg, char *str, size_t len)
{
char hostname[HOST_NAME_MAX + 1] = { 0 };
struct lyd_node *node;
const char *hostname;
char *ptr;
const char *fmt;

node = lydx_get_xpathf(cfg, "/ietf-system:system/hostname");
if (!node)
return NULL;

hostname = lyd_get_value(node);
if (!hostname || hostname[0] == 0)
fmt = lyd_get_value(node);
if (!fmt || !fmt[0])
return NULL;

ptr = strchr(hostname, '.');
if (ptr)
*ptr = 0;
if (hostnamefmt(&confd, fmt, hostname, sizeof(hostname), NULL, 0) || !hostname[0])
return NULL;

snprintf(str, len, "-x hostname:%s ", hostname);

Expand Down Expand Up @@ -262,10 +262,12 @@ int ifchange_cand_infer_dhcp(sr_session_ctx_t *session, const char *xpath)

/* Check if options already exist */
err = srx_nitems(session, &cnt, "%s/option", path);
if (err || cnt) {
ERROR("%s(): no %s/options err %d cnt %zu", __func__, path, err, cnt);
if (err) {
ERROR("%s(): failed querying %s/option: %d", __func__, path, err);
goto out;
}
if (cnt)
goto out;

/* Infer options based on IPv4 or IPv6 */
if (strstr(path, ":ipv4/"))
Expand Down
2 changes: 1 addition & 1 deletion src/confd/src/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#define XPATH_BASE_ "/ietf-routing:routing/control-plane-protocols/control-plane-protocol"
#define XPATH_OSPF_ XPATH_BASE_ "/ietf-ospf:ospf"
#define NETD_CONF "/etc/netd/conf.d/confd.conf"
#define NETD_CONF "/etc/net.d/confd.conf"
#define NETD_CONF_NEXT NETD_CONF "+"
#define NETD_CONF_PREV NETD_CONF "-"
#define OSPFD_CONF "/etc/frr/ospfd.conf"
Expand Down
2 changes: 1 addition & 1 deletion src/netd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ netd_SOURCES = src/netd.c src/netd.h src/config.c src/config.h
netd_CPPFLAGS = -D_DEFAULT_SOURCE -D_GNU_SOURCE -I$(srcdir)/src
netd_CFLAGS = -W -Wall -Wextra
netd_CFLAGS += $(libite_CFLAGS) $(libconfuse_CFLAGS) $(jansson_CFLAGS)
netd_LDADD = $(libite_LIBS) $(libconfuse_LIBS) $(jansson_LIBS)
netd_LDADD = $(libite_LIBS) $(libconfuse_LIBS) $(jansson_LIBS) $(EV_LIBS)

# Backend selection: FRR gRPC, FRR frr.conf, or Linux kernel
if HAVE_FRR_GRPC
Expand Down
8 changes: 4 additions & 4 deletions src/netd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ make install

netd uses [libconfuse](https://github.com/martinh/libconfuse) for configuration parsing, providing a clean and structured format.

Configuration files are placed in `/etc/netd/conf.d/` with the `.conf` extension. Files are processed in alphabetical order.
Configuration files are placed in `/etc/net.d/` with the `.conf` extension. Files are processed in alphabetical order.

### Configuration Format

Expand Down Expand Up @@ -219,10 +219,10 @@ rip {

### Configuration Files

Configuration files must be placed in `/etc/netd/conf.d/` with the `.conf` extension:
Configuration files must be placed in `/etc/net.d/` with the `.conf` extension:

```bash
/etc/netd/conf.d/
/etc/net.d/
├── 10-static.conf # Static routes
├── 20-rip.conf # RIP configuration
└── 99-local.conf # Local overrides
Expand Down Expand Up @@ -256,7 +256,7 @@ netd validates configuration on reload. Check syslog for errors.

```
┌─────────┐
│ confd │ Writes /etc/netd/conf.d/confd.conf
│ confd │ Writes /etc/net.d/confd.conf
└────┬────┘
│ SIGHUP
Expand Down
Loading
Loading