Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/rtsold/rtsol.c
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
static void call_script(const char *const *, struct script_msg_head_t *); | static void call_script(const char *const *, struct script_msg_head_t *); | ||||
static size_t dname_labeldec(char *, size_t, const char *); | static size_t dname_labeldec(char *, size_t, const char *); | ||||
static struct ra_opt *find_raopt(struct rainfo *, int, void *, size_t); | static struct ra_opt *find_raopt(struct rainfo *, int, void *, size_t); | ||||
static int ra_opt_rdnss_dispatch(struct ifinfo *, struct rainfo *, | static int ra_opt_rdnss_dispatch(struct ifinfo *, struct rainfo *, | ||||
struct script_msg_head_t *, struct script_msg_head_t *); | struct script_msg_head_t *, struct script_msg_head_t *); | ||||
static char *make_rsid(const char *, const char *, struct rainfo *); | static char *make_rsid(const char *, const char *, struct rainfo *); | ||||
#define _ARGS_MANAGED managedconf_script, ifi->ifname | |||||
#define _ARGS_OTHER otherconf_script, ifi->ifname | #define _ARGS_OTHER otherconf_script, ifi->ifname | ||||
#define _ARGS_RESADD resolvconf_script, "-a", rsid | #define _ARGS_RESADD resolvconf_script, "-a", rsid | ||||
#define _ARGS_RESDEL resolvconf_script, "-d", rsid | #define _ARGS_RESDEL resolvconf_script, "-d", rsid | ||||
#define CALL_SCRIPT(name, sm_head) do { \ | #define CALL_SCRIPT(name, sm_head) do { \ | ||||
const char *const sarg[] = { _ARGS_##name, NULL }; \ | const char *const sarg[] = { _ARGS_##name, NULL }; \ | ||||
call_script(sarg, sm_head); \ | call_script(sarg, sm_head); \ | ||||
} while (0) | } while (0) | ||||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | rtsol_input(int sock) | ||||
warnmsg(LOG_DEBUG, __func__, | warnmsg(LOG_DEBUG, __func__, | ||||
"received RA from %s on %s, state is %d", | "received RA from %s on %s, state is %d", | ||||
inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, sizeof(ntopbuf)), | inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, sizeof(ntopbuf)), | ||||
ifi->ifname, ifi->state); | ifi->ifname, ifi->state); | ||||
nd_ra = (struct nd_router_advert *)icp; | nd_ra = (struct nd_router_advert *)icp; | ||||
/* | /* | ||||
* Process the "M bit." | |||||
* If the value of ManagedConfigFlag changes from FALSE to TRUE, the | |||||
* host should invoke the stateful autoconfiguration protocol, | |||||
* requesting information. | |||||
* [RFC 4861 Section 4.2] | |||||
* XXX ??? [draft-ietf-v6ops-dhcpv6-slaac-problem-07] | |||||
*/ | |||||
if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_MANAGED) && | |||||
!ifi->managedconfig) { | |||||
warnmsg(LOG_DEBUG, __func__, | |||||
"ManagedConfigFlag on %s is turned on", ifi->ifname); | |||||
ifi->managedconfig = 1; | |||||
CALL_SCRIPT(MANAGED, NULL); | |||||
} | |||||
/* | |||||
* Process the "O bit." | * Process the "O bit." | ||||
* If the value of OtherConfigFlag changes from FALSE to TRUE, the | * If the value of OtherConfigFlag changes from FALSE to TRUE, the | ||||
* host should invoke the stateful autoconfiguration protocol, | * host should invoke the stateful autoconfiguration protocol, | ||||
* requesting information. | * requesting information unless the "M bit" was set as well in | ||||
* [RFC 2462 Section 5.5.3] | * which case the "O bit" is redundant. | ||||
* [RFC 4861 Section 4.2] | |||||
*/ | */ | ||||
if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_OTHER) && | if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_OTHER) && | ||||
!ifi->otherconfig) { | !ifi->otherconfig) { | ||||
warnmsg(LOG_DEBUG, __func__, | warnmsg(LOG_DEBUG, __func__, | ||||
"OtherConfigFlag on %s is turned on", ifi->ifname); | "OtherConfigFlag on %s is turned on", ifi->ifname); | ||||
ifi->otherconfig = 1; | ifi->otherconfig = 1; | ||||
if (!ifi->managedconfig) | |||||
CALL_SCRIPT(OTHER, NULL); | CALL_SCRIPT(OTHER, NULL); | ||||
} | } | ||||
clock_gettime(CLOCK_MONOTONIC_FAST, &now); | clock_gettime(CLOCK_MONOTONIC_FAST, &now); | ||||
newent_rai = 0; | newent_rai = 0; | ||||
rai = find_rainfo(ifi, &from); | rai = find_rainfo(ifi, &from); | ||||
if (rai == NULL) { | if (rai == NULL) { | ||||
ELM_MALLOC(rai, exit(1)); | ELM_MALLOC(rai, exit(1)); | ||||
rai->rai_ifinfo = ifi; | rai->rai_ifinfo = ifi; | ||||
TAILQ_INIT(&rai->rai_ra_opt); | TAILQ_INIT(&rai->rai_ra_opt); | ||||
▲ Show 20 Lines • Show All 451 Lines • Show Last 20 Lines |