NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/60836: /etc/rc.d/network picks up stray ifconfig.ifN~ backup files



>Number:         60836
>Category:       misc
>Synopsis:       /etc/rc.d/network picks up stray ifconfig.ifN~ backup files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 02 02:50:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        11
>Organization:
Network BSD Backups Ifc.
>Environment:
>Description:

	I changed /etc/ifconfig.wg0 and saved a backup as
	/etc/ifconfig.wg0.~1~ as is a common convention; the next
	`service network restart' complained:

Starting network.
Hostname: nanocons.local
IPv6 mode: host
Configuring network interfaces: emac0 wg0 ~1~ifconfig: clone_command: Invalid argument
ifconfig: exec_matches: Invalid argument
usage: ifconfig [-h] [-m] [-v] [-z] [-L] interface
...
       ifconfig interface destroy
.
Adding interface aliases:.

	The relevant logic in /etc/rc.d/network looks like it was maybe
	intended as a regular expression, not a shell glob:

    242 		for cloner in $(/sbin/ifconfig -C); do
    243 			for int in /etc/ifconfig.${cloner}[0-9]*; do
    244 				[ ! -f $int ] && break
    245 				tmp="$tmp ${int##*.}"
    246 			done
    247 		done

	https://nxr.netbsd.org/xref/src/etc/rc.d/network?r=1.85#242

	This will also get confused by ifconfig.wg0.bak,
	ifconfig.wg0.tmp, &c.

>How-To-Repeat:

	touch /etc/ifconfig.wg0.~1~
	service network restart

>Fix:

	1. Check for ${cloner}[0-9]* (or, really, ${cloner}[0-9][0-9]*)
	   as a regular expression, e.g. with expr(1)?
	2. Check for *~ and skip it?




Home | Main Index | Thread Index | Old Index