From: Steven Barth Date: Wed, 30 Oct 2013 13:13:50 +0000 (+0100) Subject: React to carrier down events as well X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c570ee307de12e47e8a370fb66d8f99f14d4b064;p=project%2Fodhcp6c.git React to carrier down events as well --- diff --git a/src/ra.c b/src/ra.c index 971a172..c8ccb88 100644 --- a/src/ra.c +++ b/src/ra.c @@ -150,6 +150,7 @@ static void update_proc(const char *sect, const char *opt, uint32_t value) bool ra_link_up(void) { + static bool firstcall = true; struct { struct nlmsghdr hdr; struct ifinfomsg msg; @@ -167,14 +168,16 @@ bool ra_link_up(void) continue; bool hascarrier = resp.msg.ifi_flags & IFF_LOWER_UP; - if (nocarrier && hascarrier) + if (!firstcall && nocarrier != !hascarrier) ret = true; nocarrier = !hascarrier; + firstcall = false; } while (read > 0); if (ret) { - syslog(LOG_NOTICE, "carrier up event on %s", if_name); + syslog(LOG_NOTICE, "carrier => %i event on %s", (int)!nocarrier, if_name); + rs_attempt = 0; ra_send_rs(SIGALRM); }