diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-06-16 15:18:30 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-07-14 13:49:34 +1000 |
commit | 6a6d2c94bd5c001750e8eaa133a61a87964efa70 (patch) | |
tree | d1d4e0599f3bf561a77d7473aa7cd1ab5564941a | |
parent | 726e72342fdd2e1fc5ad34a1aafa76b135524a0a (diff) | |
download | petitboot-6a6d2c94bd5c001750e8eaa133a61a87964efa70.zip petitboot-6a6d2c94bd5c001750e8eaa133a61a87964efa70.tar.gz |
discover/network: Mark interfaces configured once configured
In some cases additional netlink messages can be received for an
already-configured interface without any relevant changes. This can
result in multiple DHCP requests for the same interface.
Once an interface has been configured mark it as IFSTATE_CONFIGURED
to avoid configuring it again.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r-- | discover/network.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/discover/network.c b/discover/network.c index c072eec..4b79015 100644 --- a/discover/network.c +++ b/discover/network.c @@ -398,8 +398,11 @@ static void configure_interface(struct network *network, interface->state = IFSTATE_NEW; else if (!link) interface->state = IFSTATE_UP_WAITING_LINK; - else + else { + pb_debug("network: skipping configured interface %s\n", + interface->name); return; + } } /* always up the lookback, no other handling required */ @@ -451,6 +454,8 @@ static void configure_interface(struct network *network, } else if (config->method == CONFIG_METHOD_STATIC) { configure_interface_static(network, interface, config); } + + interface->state = IFSTATE_CONFIGURED; } static int network_handle_nlmsg(struct network *network, struct nlmsghdr *nlmsg) |