kern/163701: ifconfig: group parameter makes impossible to restart
interface
Dmitry Kazarov
d.y.kazarov at mail.ru
Thu Dec 29 21:20:09 UTC 2011
>Number: 163701
>Category: kern
>Synopsis: ifconfig: group parameter makes impossible to restart interface
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Dec 29 21:20:08 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Dmitry Kazarov
>Release: 8.2-STABLE
>Organization:
>Environment:
FreeBSD Trudiaga.localdomain 8.2-STABLE FreeBSD 8.2-STABLE #0: Mon Dec 12 01:42:49 MSK 2011 root at Trudiaga.localdomain:/var/obj/usr/src/sys/GENERIC i386
>Description:
If group parameter is specified in /etc/rc.conf it makes /etc/rc.d/netif restart to fail:
# fgrep re0 /etc/rc.conf
ifconfig_re0='192.168.1.20/24 group ifgrp'
# ifconfig -v re0
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=3898<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
ether 00:1f:d0:5e:8f:57
inet 192.168.1.20 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
groups: ifgrp
# /etc/rc.d/netif restart re0
Stopping Network: re0.
re0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=3898<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
ether 00:1f:d0:5e:8f:57
media: Ethernet autoselect (none)
status: no carrier
ifconfig: SIOCAIFGROUP: File exists
Starting Network: re0.
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=3898<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
ether 00:1f:d0:5e:8f:57
media: Ethernet autoselect (none)
status: no carrier
The source of problem is that groups parameter persist when interface goes down:
# /etc/rc.d/netif stop re0
Stopping Network: re0.
re0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=3898<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
ether 00:1f:d0:5e:8f:57
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
# ifconfig -v re0
re0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=3898<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
ether 00:1f:d0:5e:8f:57
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
groups: ifgrp
IMHO it's better to just ignore error when group param specifies groupname to which interface is already assigned.
>How-To-Repeat:
>Fix:
--- src/sbin/ifconfig/ifgroup.c.orig 2011-12-30 01:07:54.000000000 +0400
+++ src/sbin/ifconfig/ifgroup.c 2011-12-30 01:09:09.000000000 +0400
@@ -58,7 +58,10 @@
if (strlcpy(ifgr.ifgr_group, group_name, IFNAMSIZ) >= IFNAMSIZ)
errx(1, "setifgroup: group name too long");
if (ioctl(s, SIOCAIFGROUP, (caddr_t)&ifgr) == -1)
- err(1," SIOCAIFGROUP");
+ if (errno == EEXIST)
+ return;
+ else
+ err(1," SIOCAIFGROUP");
}
/* ARGSUSED */
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list