ifsuffix=":ra";;
INFORM6|BOUND6|RENEW6|REBIND6|REBOOT6|EXPIRE6|RELEASE6|STOP6)
ifsuffix=":dhcp6";;
+ STOPPED) # This reason should never be processed
+ exit 0;;
*)
ifsuffix=;;
esac
eloop_timeout_delete(ctx->eloop, NULL, ifp);
if (ifp->options->options & DHCPCD_DEPARTED)
script_runreason(ifp, "DEPARTED");
+ else
+ script_runreason(ifp, "STOPPED");
if_free(ifp);
if (!(ctx->options & (DHCPCD_MASTER | DHCPCD_TEST)))
eloop_exit(ctx->eloop, EXIT_FAILURE);
if (argc == 1) {
TAILQ_FOREACH(ifp, ctx->ifaces, next) {
len++;
+ if (D_STATE(ifp))
+ len++;
if (D6_STATE_RUNNING(ifp))
len++;
if (ipv6nd_has_ra(ifp))
TAILQ_FOREACH(ifp, ctx->ifaces, next) {
if (strcmp(argv[opt], ifp->name) == 0) {
len++;
+ if (D_STATE(ifp))
+ len++;
if (D6_STATE_RUNNING(ifp))
len++;
if (ipv6nd_has_ra(ifp))
{
const char *reason;
int retval = 0;
- int onestate = 0;
#ifdef INET
const struct dhcp_state *d = D_CSTATE(ifp);
#endif
const struct dhcp6_state *d6 = D6_CSTATE(ifp);
#endif
+ switch (ifp->carrier) {
+ case LINK_UP:
+ reason = "CARRIER";
+ break;
+ case LINK_DOWN:
+ reason = "NOCARRIER";
+ break;
+ default:
+ reason = "UNKNOWN";
+ break;
+ }
+ if (send_interface1(fd, ifp, reason) == -1)
+ retval = -1;
#ifdef INET
- if (d) {
- onestate = 1;
+ if (d)
if (send_interface1(fd, ifp, d->reason) == -1)
retval = -1;
- }
#endif
#ifdef INET6
if (ipv6nd_has_ra(ifp)) {
- onestate = 1;
if (send_interface1(fd, ifp, "ROUTERADVERT") == -1)
retval = -1;
}
if (D6_STATE_RUNNING(ifp)) {
- onestate = 1;
if (send_interface1(fd, ifp, d6->reason) == -1)
retval = -1;
}
#endif
- if (!onestate) {
- switch (ifp->carrier) {
- case LINK_UP:
- reason = "CARRIER";
- break;
- case LINK_DOWN:
- reason = "NOCARRIER";
- break;
- default:
- reason = "UNKNOWN";
- break;
- }
- if (send_interface1(fd, ifp, reason) == -1)
- retval = -1;
- }
return retval;
}