Enhancement #2075
Update NetworksDB on udev events
Status: | CLOSED | Start date: | 08/01/2013 | |
---|---|---|---|---|
Priority: | Normal | Due date: | 08/02/2013 | |
Assignee: | - | % Done: | 100% | |
Category: | nethserver-base | |||
Target version: | v6.4-beta2 | |||
Resolution: | NEEDINFO: | No |
Description
Replace source:nethserver-firewall-base|root/usr/share/nethesis/NethServer/Module/NetworkAdapter.php@f9ebff4b#L39 with udev rule like this:
# cat /etc/udev/rules.d/90-NetworksDB.rules SUBSYSTEM=="net", KERNEL=="eth*", RUN="/usr/libexec/nethserver/update-networks-db"
Note that PROGRAM can be run concurrently if the rule matches more than one eth* interface.
Related issues
Associated revisions
Imported NetworkAdapter UI module from nethserver-firewall-base package. Refs #2075
NetworkAdapter UI module: update-networks-db script must not be called by server-manager. Refs #2075
NetworkAdapter UI module: moved in Configuration category. Refs #2075
update-networks-db: use udev function library to check filesystem is writeable. Refs #2075
Execute update-networks-db after udev-post startup and on udev events. Refs #2075
NetworkAdapter UI module moved into nethserver-base. Refs #2075
/etc/sudoers template (20nics): removed, nic-info can run unprivileged, update-networks-db is no longer invoked by httpd-admin. Refs #2075
History
#1 Updated by Davide Principi about 8 years ago
- File dumpenv.eth1.log added
When PROGRAM is executed it receives settings through the environment. See the dumpenv.eth1.log for details.
#2 Updated by Giacomo Sanchietti about 8 years ago
- NEEDINFO changed from No to Yes
Can't replicate this behavior: no matter what script is configured, nothing is called (even after hardware change and reboot).
#3 Updated by Davide Principi about 8 years ago
- Description updated (diff)
- Due date set to 08/02/2013
- Status changed from NEW to TRIAGED
- Assignee set to Davide Principi
- Target version set to v6.4-beta2
- Start date set to 08/01/2013
- % Done changed from 0 to 20
- Estimated time set to 8.00
- NEEDINFO changed from Yes to No
Also execute update-networks-db
at startup for new PCI cards.
#4 Updated by Davide Principi about 8 years ago
- Status changed from TRIAGED to MODIFIED
- % Done changed from 20 to 60
Test case
- Add a new NIC; after boot a new entry with NIC MAC address must be in networks DB
- Plug an USB network adapter: a new entry must be created automatically in networks DB
Execute also test case from #2103
#5 Updated by Davide Principi about 8 years ago
- Assignee deleted (
Davide Principi)
#6 Updated by Davide Principi about 8 years ago
- Status changed from MODIFIED to ON_QA
- % Done changed from 60 to 70
- nethserver-base-1.4.0-12.0git855f8d09.ns6.noarch.rpm
- nethserver-firewall-base-1.0.4-1.0gitefdc4b76.ns6.noarch.rpm
#7 Updated by Giacomo Sanchietti almost 8 years ago
- Assignee set to Giacomo Sanchietti
#8 Updated by Giacomo Sanchietti almost 8 years ago
One ethernet before reboot:
eth0 Link encap:Ethernet HWaddr 08:00:27:xx:xx:xx inet addr:192.168.x.x Bcast:192.168.5.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe77:c322/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:167196 errors:0 dropped:0 overruns:0 frame:0 TX packets:39773 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:216920918 (206.8 MiB) TX bytes:8333620 (7.9 MiB) [root@test ~]# db networks show eth0=ethernet bootproto=static device=eth0 gateway=192.168.x.xx hwaddr=08:00:27:xx:xx:xx ipaddr=192.168.x.x ipv6init=yes netmask=255.255.255.0 nm_controlled=yes onboot=yes role=green uuid=d935ff2e-73f8-45b2-92c1-fb1a98f5f7b7Before reboot added 3 new network cards:
- pcnet
- e1000
- virtio
[root@test ~]# db networks show eth0=ethernet bootproto=static device=eth0 gateway=192.168.x.xx hwaddr=08:00:27:xx:xx:xx ipaddr=192.168.x.x ipv6init=yes netmask=255.255.255.0 nm_controlled=yes onboot=yes role=green uuid=d935ff2e-73f8-45b2-92c1-fb1a98f5f7b7 eth1=ethernet hwaddr=08:00:27:52:xx:xx role= eth2=ethernet hwaddr=08:00:27:6a:xx:xx role= eth3=ethernet hwaddr=08:00:27:xx:xx:xx role=
Extract from messages during boot:
Aug 28 12:08:07 test /sbin/e-smith/db[1584]: /var/lib/nethserver/db/networks: OLD eth1=(undefined) Aug 28 12:08:07 test /sbin/e-smith/db[1584]: /var/lib/nethserver/db/networks: NEW eth1=ethernet Aug 28 12:08:07 test /sbin/e-smith/db[1584]: /var/lib/nethserver/db/networks: OLD eth1=ethernet Aug 28 12:08:07 test /sbin/e-smith/db[1584]: /var/lib/nethserver/db/networks: NEW eth1=ethernet|hwaddr|08:00:27:52:xx:xx Aug 28 12:08:07 test /sbin/e-smith/db[1585]: /var/lib/nethserver/db/networks: OLD eth1=ethernet|hwaddr|08:00:27:52:xx:xx Aug 28 12:08:07 test /sbin/e-smith/db[1585]: /var/lib/nethserver/db/networks: NEW eth1=ethernet|hwaddr|08:00:27:52:ff:ad|role| Aug 28 12:08:07 test /sbin/e-smith/db[1597]: /var/lib/nethserver/db/networks: OLD eth2=(undefined) Aug 28 12:08:07 test /sbin/e-smith/db[1597]: /var/lib/nethserver/db/networks: NEW eth2=ethernet Aug 28 12:08:07 test /sbin/e-smith/db[1597]: /var/lib/nethserver/db/networks: OLD eth2=ethernet Aug 28 12:08:07 test /sbin/e-smith/db[1597]: /var/lib/nethserver/db/networks: NEW eth2=ethernet|hwaddr|08:00:27:6a:xx:xx Aug 28 12:08:07 test /sbin/e-smith/db[1598]: /var/lib/nethserver/db/networks: OLD eth2=ethernet|hwaddr|08:00:27:6a:xx:xx Aug 28 12:08:07 test /sbin/e-smith/db[1598]: /var/lib/nethserver/db/networks: NEW eth2=ethernet|hwaddr|08:00:27:6a:bb:fc|role| Aug 28 12:08:08 test /sbin/e-smith/db[1610]: /var/lib/nethserver/db/networks: OLD eth3=(undefined) Aug 28 12:08:08 test /sbin/e-smith/db[1610]: /var/lib/nethserver/db/networks: NEW eth3=ethernet Aug 28 12:08:08 test /sbin/e-smith/db[1610]: /var/lib/nethserver/db/networks: OLD eth3=ethernet Aug 28 12:08:08 test /sbin/e-smith/db[1610]: /var/lib/nethserver/db/networks: NEW eth3=ethernet|hwaddr|08:00:27:21:xx:xx Aug 28 12:08:08 test /sbin/e-smith/db[1611]: /var/lib/nethserver/db/networks: OLD eth3=ethernet|hwaddr|08:00:27:21:xx:xx Aug 28 12:08:08 test /sbin/e-smith/db[1611]: /var/lib/nethserver/db/networks: NEW eth3=ethernet|hwaddr|08:00:27:21:98:94|role|
After adding a USB wireless device, extract from messages:
Aug 28 14:16:34 nsrv kernel: usb 1-7: new high speed USB device number 2 using ehci_hcd Aug 28 14:16:34 nsrv kernel: usb 1-7: New USB device found, idVendor=0586, idProduct=3401 Aug 28 14:16:34 nsrv kernel: usb 1-7: New USB device strings: Mfr=16, Product=32, SerialNumber=0 Aug 28 14:16:34 nsrv kernel: usb 1-7: Product: ZyAIR G-220 Aug 28 14:16:34 nsrv kernel: usb 1-7: Manufacturer: ZyXEL Aug 28 14:16:34 nsrv kernel: usb 1-7: configuration #1 chosen from 1 choice Aug 28 14:16:34 nsrv kernel: cfg80211: Calling CRDA to update world regulatory domain Aug 28 14:16:35 nsrv kernel: usb 1-7: reset high speed USB device number 2 using ehci_hcd Aug 28 14:16:35 nsrv kernel: zd1211rw 1-7:1.0: phy0 Aug 28 14:16:35 nsrv kernel: usbcore: registered new interface driver zd1211rw Aug 28 14:16:35 nsrv kernel: cfg80211: World regulatory domain updated: Aug 28 14:16:35 nsrv kernel: cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp) Aug 28 14:16:35 nsrv kernel: cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm) Aug 28 14:16:35 nsrv kernel: cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm) Aug 28 14:16:35 nsrv kernel: cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm) Aug 28 14:16:35 nsrv kernel: cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm) Aug 28 14:16:35 nsrv kernel: cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm) Aug 28 14:16:35 nsrv kernel: cfg80211: Calling CRDA for country: IT Aug 28 14:16:35 nsrv kernel: cfg80211: Regulatory domain changed to country: IT Aug 28 14:16:35 nsrv kernel: cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp) Aug 28 14:16:35 nsrv kernel: cfg80211: (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm) Aug 28 14:16:35 nsrv kernel: cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 2000 mBm) Aug 28 14:16:35 nsrv kernel: cfg80211: (5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 mBm) Aug 28 14:16:35 nsrv kernel: cfg80211: (5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A, 2700 mBm) Aug 28 14:16:36 nsrv /sbin/e-smith/db[20175]: /var/lib/nethserver/db/networks: OLD wlan0=(undefined) Aug 28 14:16:36 nsrv /sbin/e-smith/db[20175]: /var/lib/nethserver/db/networks: NEW wlan0=ethernet Aug 28 14:16:36 nsrv /sbin/e-smith/db[20175]: /var/lib/nethserver/db/networks: OLD wlan0=ethernet Aug 28 14:16:36 nsrv /sbin/e-smith/db[20175]: /var/lib/nethserver/db/networks: NEW wlan0=ethernet|hwaddr|00:13:49:03:7f:17 Aug 28 14:16:36 nsrv /sbin/e-smith/db[20176]: /var/lib/nethserver/db/networks: OLD wlan0=ethernet|hwaddr|00:13:49:03:7f:17 Aug 28 14:16:36 nsrv /sbin/e-smith/db[20176]: /var/lib/nethserver/db/networks: NEW wlan0=ethernet|hwaddr|00:13:49:03:7f:17|role|
#9 Updated by Giacomo Sanchietti almost 8 years ago
- Status changed from ON_QA to VERIFIED
- Assignee deleted (
Giacomo Sanchietti) - % Done changed from 70 to 90
Marking as VERIFIED.
#10 Updated by Davide Principi almost 8 years ago
- Status changed from VERIFIED to CLOSED
- % Done changed from 90 to 100
In nethserver-updates:
nethserver-base-1.4.1-1.ns6.noarch.rpm
nethserver-httpd-admin-1.0.5-1.ns6.noarch.rpm
nethserver-firewall-base-1.0.5-1.ns6.noarch.rpm