summaryrefslogtreecommitdiffhomepage
path: root/netboot
diff options
context:
space:
mode:
authorƁukasz Siudut <lsiudut@gmail.com>2019-03-07 11:05:39 +0000
committerPablo Mazzini <pmazzini@gmail.com>2019-03-07 11:05:39 +0000
commit5859695ac2f7e59f6a7de0a0353aa1e1f19aa6aa (patch)
treef105ce26849116450112aabb77d82bd091e2f09e /netboot
parent79d46990f4f341ec53d906d0a708c1a4aeab942e (diff)
Allow Unknown OperState of the link interface (#254)
* Allow Unknowo OperState of the link interface We hig a bug when Netconf library was failing to bring interface up despite the fact that it was actually up. It turned out that it's oper state was not set to UP, what is expected by the library. According to kernel documentation it is ok proceed if interface state is Up or Unknown: ``` Interface is in RFC2863 operational state UP or UNKNOWN. This is for backward compatibility, routing daemons, dhcp clients can use this flag to determine whether they should use the interface. ``` Also, resaon why operational state may remain Unknown: ``` IF_OPER_UNKNOWN (0): Interface is in unknown state, neither driver nor userspace has set operational state. Interface must be considered for user data as setting operational state has not been implemented in every driver. ``` I modified our code to try DHCP transaction even if `IfUp` failed, but the OperState was equal to Unknown - it worked perfectly. * Skip rt7 test also with go 1.10 and 1.11 As per request from @pmazzini.
Diffstat (limited to 'netboot')
-rw-r--r--netboot/netconf.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/netboot/netconf.go b/netboot/netconf.go
index de4d23d..d05fa80 100644
--- a/netboot/netconf.go
+++ b/netboot/netconf.go
@@ -144,8 +144,14 @@ func IfUp(ifname string, timeout time.Duration) (netlink.Link, error) {
return nil, fmt.Errorf("cannot get interface %q by name: %v", ifname, err)
}
- // if the interface is up, return
- if iface.Attrs().OperState == netlink.OperUp {
+ // If the interface is up, return. According to kernel documentation OperState may
+ // be either Up or Unknown:
+ // Interface is in RFC2863 operational state UP or UNKNOWN. This is for
+ // backward compatibility, routing daemons, dhcp clients can use this
+ // flag to determine whether they should use the interface.
+ // Source: https://www.kernel.org/doc/Documentation/networking/operstates.txt
+ operState := iface.Attrs().OperState
+ if operState == netlink.OperUp || operState == netlink.OperUnknown {
// XXX despite the OperUp state, upon the first attempt I
// consistently get a "cannot assign requested address" error. This
// may be a bug in the netlink library. Need to investigate more.