-/* $OpenBSD: engine.c,v 1.73 2021/07/12 15:09:19 beck Exp $ */
+/* $OpenBSD: engine.c,v 1.74 2021/07/22 15:32:51 kn Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
void engine_showinfo_ctl(struct imsg *, uint32_t);
void debug_log_ra(struct imsg_ra *);
int in6_mask2prefixlen(struct in6_addr *);
+#endif /* SMALL */
void deprecate_all_proposals(struct slaacd_iface *);
void send_rdns_withdraw(struct slaacd_iface *);
-#endif /* SMALL */
struct slaacd_iface *get_slaacd_iface_by_id(uint32_t);
void remove_slaacd_iface(uint32_t);
void free_ra(struct radv *);
void configure_dfr(struct dfr_proposal *);
void free_dfr_proposal(struct dfr_proposal *);
void withdraw_dfr(struct dfr_proposal *);
-#ifndef SMALL
void update_iface_ra_rdns(struct slaacd_iface *,
struct radv *);
void gen_rdns_proposal(struct slaacd_iface *, struct
void propose_rdns(struct rdns_proposal *);
void free_rdns_proposal(struct rdns_proposal *);
void compose_rdns_proposal(uint32_t, int);
-#endif /* SMALL */
char *parse_dnssl(char *, int);
void update_iface_ra(struct slaacd_iface *, struct radv *);
void update_iface_ra_dfr(struct slaacd_iface *,
void start_probe(struct slaacd_iface *);
void address_proposal_timeout(int, short, void *);
void dfr_proposal_timeout(int, short, void *);
-#ifndef SMALL
void rdns_proposal_timeout(int, short, void *);
-#endif /* SMALL */
void iface_timeout(int, short, void *);
struct radv *find_ra(struct slaacd_iface *, struct sockaddr_in6 *);
struct address_proposal *find_address_proposal_by_addr(struct slaacd_iface *,
struct sockaddr_in6 *);
struct dfr_proposal *find_dfr_proposal_by_gw(struct slaacd_iface *,
struct sockaddr_in6 *);
-#ifndef SMALL
struct rdns_proposal *find_rdns_proposal_by_gw(struct slaacd_iface *,
struct sockaddr_in6 *);
-#endif /* SMALL */
struct radv_prefix *find_prefix(struct radv *, struct radv_prefix *);
int engine_imsg_compose_main(int, pid_t, void *, uint16_t);
uint32_t real_lifetime(struct timespec *, uint32_t);
evtimer_add(&addr_proposal->timer, &tv);
}
break;
-#ifndef SMALL
case IMSG_REPROPOSE_RDNS:
LIST_FOREACH (iface, &slaacd_interfaces, entries)
compose_rdns_proposal(iface->if_index,
iface->rdomain);
break;
-#endif /* SMALL */
default:
log_debug("%s: unexpected imsg %d", __func__,
imsg.hdr.type);
struct imsg_ifinfo imsg_ifinfo;
ssize_t n;
int shut = 0;
-#ifndef SMALL
struct slaacd_iface *iface;
struct imsg_addrinfo imsg_addrinfo;
struct address_proposal *addr_proposal = NULL;
size_t i;
-#endif /* SMALL */
if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
}
}
+#endif /* SMALL */
+
void
deprecate_all_proposals(struct slaacd_iface *iface)
{
compose_rdns_proposal(iface->if_index, iface->rdomain);
}
-#endif /* SMALL */
-
struct slaacd_iface*
get_slaacd_iface_by_id(uint32_t if_index)
{
struct radv *ra;
struct address_proposal *addr_proposal;
struct dfr_proposal *dfr_proposal;
-#ifndef SMALL
struct rdns_proposal *rdns_proposal;
-#endif /* SMALL */
iface = get_slaacd_iface_by_id(if_index);
dfr_proposal = LIST_FIRST(&iface->dfr_proposals);
free_dfr_proposal(dfr_proposal);
}
-#ifndef SMALL
while(!LIST_EMPTY(&iface->rdns_proposals)) {
rdns_proposal = LIST_FIRST(&iface->rdns_proposals);
free_rdns_proposal(rdns_proposal);
}
compose_rdns_proposal(iface->if_index, iface->rdomain);
-#endif /* SMALL */
evtimer_del(&iface->timer);
free(iface);
}
else {
/* XXX correct state transition */
-#ifndef SMALL
send_rdns_withdraw(iface);
deprecate_all_proposals(iface);
-#endif /* SMALL */
iface->state = IF_DOWN;
if (evtimer_pending(&iface->timer, NULL))
evtimer_del(&iface->timer);
update_iface_ra_prefix(iface, ra, prefix);
}
-#ifndef SMALL
update_iface_ra_rdns(iface, ra);
-#endif /* SMALL */
}
void
}
}
-#ifndef SMALL
void
update_iface_ra_rdns(struct slaacd_iface *iface, struct radv *ra)
{
break;
}
}
-#endif /* SMALL */
void
timeout_from_lifetime(struct address_proposal *addr_proposal)
free(dfr_proposal);
}
-#ifndef SMALL
void
gen_rdns_proposal(struct slaacd_iface *iface, struct radv *ra)
{
evtimer_del(&rdns_proposal->timer);
free(rdns_proposal);
}
-#endif /* SMALL */
void
start_probe(struct slaacd_iface *iface)
}
}
-#ifndef SMALL
void
rdns_proposal_timeout(int fd, short events, void *arg)
{
proposal_state_name[rdns_proposal->state]);
}
}
-#endif /* SMALL */
void
iface_timeout(int fd, short events, void *arg)
struct timeval tv;
struct address_proposal *addr_proposal;
struct dfr_proposal *dfr_proposal;
-#ifndef SMALL
struct rdns_proposal *rdns_proposal;
-#endif /* SMALL */
log_debug("%s[%d]: %s", __func__, iface->if_index,
if_state_name[iface->state]);
dfr_proposal->state = PROPOSAL_STALE;
free_dfr_proposal(dfr_proposal);
}
-#ifndef SMALL
while(!LIST_EMPTY(&iface->rdns_proposals)) {
rdns_proposal = LIST_FIRST(&iface->rdns_proposals);
rdns_proposal->state = PROPOSAL_STALE;
free_rdns_proposal(rdns_proposal);
}
compose_rdns_proposal(iface->if_index, iface->rdomain);
-#endif /* SMALL */
break;
case IF_DOWN:
case IF_IDLE:
return (NULL);
}
-#ifndef SMALL
struct rdns_proposal*
find_rdns_proposal_by_gw(struct slaacd_iface *iface, struct sockaddr_in6
*from)
return (NULL);
}
-#endif /* SMALL */
struct radv_prefix *
find_prefix(struct radv *ra, struct radv_prefix *prefix)
-/* $OpenBSD: slaacd.c,v 1.61 2021/07/21 03:53:50 kn Exp $ */
+/* $OpenBSD: slaacd.c,v 1.62 2021/07/22 15:32:51 kn Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
void configure_gateway(struct imsg_configure_dfr *, uint8_t);
void add_gateway(struct imsg_configure_dfr *);
void delete_gateway(struct imsg_configure_dfr *);
-#ifndef SMALL
void send_rdns_proposal(struct imsg_propose_rdns *);
-#endif /* SMALL */
int get_soiikey(uint8_t *);
static int main_imsg_send_ipc_sockets(struct imsgbuf *, struct imsgbuf *);
int frontend_routesock, rtfilter, lockfd;
int rtable_any = RTABLE_ANY;
char *csock = _PATH_SLAACD_SOCKET;
-#ifndef SMALL
struct imsg_propose_rdns rdns;
+#ifndef SMALL
int control_fd;
#endif /* SMALL */
main_imsg_compose_frontend(IMSG_STARTUP, -1, NULL, 0);
-#ifndef SMALL
/* we are taking over, clear all previos slaac proposals */
memset(&rdns, 0, sizeof(rdns));
rdns.if_index = 0;
rdns.rdns_count = 0;
send_rdns_proposal(&rdns);
-#endif /* SMALL */
event_dispatch();
struct imsg imsg;
struct imsg_configure_address address;
struct imsg_configure_dfr dfr;
-#ifndef SMALL
struct imsg_propose_rdns rdns;
-#endif /* SMALL */
ssize_t n;
int shut = 0;
memcpy(&dfr, imsg.data, sizeof(dfr));
delete_gateway(&dfr);
break;
-#ifndef SMALL
case IMSG_PROPOSE_RDNS:
if (IMSG_DATA_SIZE(imsg) != sizeof(rdns))
fatalx("%s: IMSG_PROPOSE_RDNS wrong "
rdns.rdns_count);
send_rdns_proposal(&rdns);
break;
-#endif /* SMALL */
default:
log_debug("%s: error handling imsg %d", __func__,
imsg.hdr.type);
configure_gateway(dfr, RTM_DELETE);
}
-#ifndef SMALL
void
send_rdns_proposal(struct imsg_propose_rdns *rdns)
{
log_warn("failed to send route message");
}
+#ifndef SMALL
const char*
sin6_to_str(struct sockaddr_in6 *sin6)
{