Mercurial > hg > dhcpcd
changeset 2453:89e99fec4757 draft
Support ND6_IFF_OVERRIDE_RTADV
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 30 Apr 2014 14:13:22 +0000 |
| parents | 191d774c7b20 |
| children | 5d965f193b71 |
| files | dhcpcd.c if-bsd.c |
| diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dhcpcd.c Wed Apr 30 10:02:20 2014 +0000 +++ b/dhcpcd.c Wed Apr 30 14:13:22 2014 +0000 @@ -350,6 +350,7 @@ ifp->ctx->options & DHCPCD_IPV6RA_OWN ? 1 : 0); ra_iface = if_checkipv6(ifp->ctx, ifp->name, ifp->options->options & DHCPCD_IPV6RA_OWN ? 1 : 0); + printf ("ra global %d ifp %d\n", ra_global, ra_iface); if (ra_global == -1 || ra_iface == -1) ifo->options &= ~DHCPCD_IPV6RS; else if (ra_iface == 0)
--- a/if-bsd.c Wed Apr 30 10:02:20 2014 +0000 +++ b/if-bsd.c Wed Apr 30 14:13:22 2014 +0000 @@ -1000,15 +1000,24 @@ return; for (; ctx->ra_restore_len > 0; ctx->ra_restore_len--) { +#ifdef ND6_IFF_ACCEPT_RTADV if (!(ctx->options & DHCPCD_FORKED)) { syslog(LOG_INFO, "%s: restoring kernel IPv6 RA support", ctx->ra_restore[ctx->ra_restore_len - 1]); if (set_if_nd6_flag( ctx->ra_restore[ctx->ra_restore_len -1], ND6_IFF_ACCEPT_RTADV) == -1) + syslog(LOG_ERR, "%s: set_if_nd6_flag: %m", + ctx->ra_restore[ctx->ra_restore_len - 1]); +#ifdef ND6_IFF_OVERRIDE_RTADV + if (ctx->ra_kernel_set == 0 && del_if_nd6_flag( + ctx->ra_restore[ctx->ra_restore_len -1], + ND6_IFF_OVERRIDE_RTADV) == -1) syslog(LOG_ERR, "%s: del_if_nd6_flag: %m", ctx->ra_restore[ctx->ra_restore_len - 1]); +#endif } +#endif free(ctx->ra_restore[ctx->ra_restore_len - 1]); } free(ctx->ra_restore); @@ -1045,6 +1054,9 @@ int ra; if (ifname) { +#ifdef ND6_IFF_OVERRIDE_RTADV + int override; +#endif #ifdef ND6_IFF_ACCEPT_RTADV size_t i; char *p, **nrest; @@ -1064,6 +1076,14 @@ } #endif +#ifdef ND6_IFF_OVERRIDE_RTADV + override = get_if_nd6_flag(ifname, ND6_IFF_OVERRIDE_RTADV); + if (override == -1) + syslog(LOG_ERR, "%s: get_if_nd6_flag: %m", ifname); + else if (override == 0 && !own) + return 0; +#endif + #ifdef ND6_IFF_ACCEPT_RTADV ra = get_if_nd6_flag(ifname, ND6_IFF_ACCEPT_RTADV); if (ra == -1) @@ -1079,6 +1099,16 @@ ifname); return ra; } +#ifdef ND6_IFF_OVERRIDE_RTADV + if (override == 0 && ctx->ra_kernel_set == 0 && + set_if_nd6_flag(ifname, ND6_IFF_OVERRIDE_RTADV) + == -1) + { + syslog(LOG_ERR, "%s: set_if_nd6_flag: %m", + ifname); + return ra; + } +#endif for (i = 0; i < ctx->ra_restore_len; i++) if (strcmp(ctx->ra_restore[i], ifname) == 0) break;
