From c570ee307de12e47e8a370fb66d8f99f14d4b064 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Wed, 30 Oct 2013 14:13:50 +0100 Subject: [PATCH] React to carrier down events as well --- src/ra.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); } -- 2.30.2