Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: recent dhcpcd looping on ppp0
On Sunday 28 Sep 2014 22:06:47 Roy Marples wrote:
> Going to guess that ppp0 doesn't have a carrier status OR IFF_RUNNING set?
> The attached patch should reduce the log spam, let me know how it works out.
Errm, this patch should do better!
Roy
Index: dhcpcd.c
==================================================================
--- dhcpcd.c
+++ dhcpcd.c
@@ -547,13 +547,15 @@
* dhcpcd has already set it.
*
* So we check the flags now. If IFF_UP is still not set
* then we should expect an accompanying link_down message */
if_setflag(ifp, 0); /* will set ifp->flags */
+ ifp->options->options &= ~DHCPCD_LINK_WARNED;
break;
default:
ifp->flags = flags;
+ ifp->options->options &= ~DHCPCD_LINK_WARNED;
}
if (carrier == LINK_UNKNOWN)
syslog(LOG_ERR, "%s: carrier_status: %m", ifname);
/* IFF_RUNNING is checked, if needed, earlier and is OS dependant */
@@ -648,21 +650,26 @@
if (ifo->options & DHCPCD_LINK) {
link_retry:
switch (ifp->carrier) {
case LINK_UP:
+ ifo->options &= ~DHCPCD_LINK_WARNED;
break;
case LINK_DOWN:
+ ifo->options &= ~DHCPCD_LINK_WARNED;
syslog(LOG_INFO, "%s: waiting for carrier", ifp->name);
return;
case LINK_UNKNOWN:
/* No media state available, so we loop until
* IFF_UP and IFF_RUNNING are set. */
ifp->carrier = if_carrier(ifp);
if (ifp->carrier != LINK_UNKNOWN)
goto link_retry;
- syslog(LOG_INFO, "%s: unknown carrier", ifp->name);
+ if (!(ifo->options & DHCPCD_LINK_WARNED)) {
+ syslog(LOG_INFO, "%s: unknown carrier", ifp->name);
+ ifo->options |= DHCPCD_LINK_WARNED;
+ }
tv.tv_sec = 0;
tv.tv_usec = 100;
eloop_timeout_add_tv(ifp->ctx->eloop, &tv,
dhcpcd_startinterface, ifp);
return;
Index: if-options.h
==================================================================
--- if-options.h
+++ if-options.h
@@ -104,10 +104,11 @@
#define DHCPCD_DHCP (1ULL << 49)
#define DHCPCD_DHCP6 (1ULL << 50)
#define DHCPCD_NOPFXDLG (1ULL << 51)
#define DHCPCD_PFXDLGONLY (1ULL << 52)
#define DHCPCD_PFXDLGMIX (1ULL << 53)
+#define DHCPCD_LINK_WARNED (1ULL << 54)
extern const struct option cf_options[];
struct if_sla {
char ifname[IF_NAMESIZE];
Home |
Main Index |
Thread Index |
Old Index