installer.
This removes the control socket handling which is useless because we
won't have slaacctl in the installer.
Also deraadt@ pointed out that this would be the first use of log.c in
the installer where we don't have syslogd running so it's rather
pointless. So this completely neuters logging.
The log.h change doesn't interfere with benno@'s efforts of unifying
log.c
The installer version of slaacd won't even compile control.c and log.c
-/* $OpenBSD: control.h,v 1.1 2017/06/03 10:00:29 florian Exp $ */
+/* $OpenBSD: control.h,v 1.2 2017/07/06 15:02:53 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef SMALL
struct {
struct event ev;
struct event evt;
void control_dispatch_imsg(int, short, void *);
int control_imsg_relay(struct imsg *);
void control_cleanup(char *);
+#endif /* SMALL */
-/* $OpenBSD: engine.c,v 1.3 2017/07/05 20:18:11 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.4 2017/07/06 15:02:53 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
void engine_sig_handler(int sig, short, void *);
void engine_dispatch_frontend(int, short, void *);
void engine_dispatch_main(int, short, void *);
+#ifndef SMALL
void send_interface_info(struct slaacd_iface *, pid_t);
void engine_showinfo_ctl(struct imsg *, uint32_t);
+#endif /* SMALL */
struct slaacd_iface *get_slaacd_iface_by_id(uint32_t);
void remove_slaacd_iface(uint32_t);
void free_ra(struct radv *);
struct dfr_proposal *dfr_proposal = NULL;
struct imsg_del_addr del_addr;
ssize_t n;
- int shut = 0, verbose;
+ int shut = 0;
+#ifndef SMALL
+ int verbose;
+#endif /* SMALL */
uint32_t if_index;
if (event & EV_READ) {
break;
switch (imsg.hdr.type) {
+#ifndef SMALL
case IMSG_CTL_LOG_VERBOSE:
/* Already checked by frontend. */
memcpy(&verbose, imsg.data, sizeof(verbose));
memcpy(&if_index, imsg.data, sizeof(if_index));
engine_showinfo_ctl(&imsg, if_index);
break;
+#endif /* SMALL */
case IMSG_UPDATE_IF:
if (imsg.hdr.len != IMSG_HEADER_SIZE +
sizeof(imsg_ifinfo))
}
}
+#ifndef SMALL
void
send_interface_info(struct slaacd_iface *iface, pid_t pid)
{
break;
}
}
+#endif /* SMALL */
struct slaacd_iface*
get_slaacd_iface_by_id(uint32_t if_index)
-/* $OpenBSD: frontend.c,v 1.2 2017/07/03 19:02:04 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.3 2017/07/06 15:02:53 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
log_init(debug, LOG_DAEMON);
log_setverbose(verbose);
+#ifndef SMALL
/* Create slaacd control socket outside chroot. */
if (control_init(sockname) == -1)
fatalx("control socket setup failed");
+#endif /* SMALL */
if ((pw = getpwnam(SLAACD_USER)) == NULL)
fatal("getpwnam");
iev_main->handler, iev_main);
event_add(&iev_main->ev, NULL);
+#ifndef SMALL
/* Listen on control socket. */
TAILQ_INIT(&ctl_conns);
control_listen();
+#endif /* SMALL */
event_set(&ev_route, routesock, EV_READ | EV_PERSIST, route_receive,
NULL);
case IMSG_STARTUP:
frontend_startup();
break;
+#ifndef SMALL
case IMSG_CTL_END:
control_imsg_relay(&imsg);
break;
+#endif /* SMALL */
default:
log_debug("%s: error handling imsg %d", __func__,
imsg.hdr.type);
break;
switch (imsg.hdr.type) {
+#ifndef SMALL
case IMSG_CTL_END:
case IMSG_CTL_SHOW_INTERFACE_INFO:
case IMSG_CTL_SHOW_INTERFACE_INFO_RA:
case IMSG_CTL_SHOW_INTERFACE_INFO_DFR_PROPOSAL:
control_imsg_relay(&imsg);
break;
+#endif /* SMALL */
case IMSG_CTL_SEND_SOLICITATION:
if_index = *((uint32_t *)imsg.data);
send_solicitation(if_index);
-/* $OpenBSD: frontend.h,v 1.1 2017/06/03 10:00:29 florian Exp $ */
+/* $OpenBSD: frontend.h,v 1.2 2017/07/06 15:02:53 florian Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef SMALL
TAILQ_HEAD(ctl_conns, ctl_conn) ctl_conns;
+#endif /* SMALL */
void frontend(int, int, char *);
void frontend_dispatch_main(int, short, void *);
-/* $OpenBSD: log.h,v 1.1 2017/06/03 10:00:29 florian Exp $ */
+/* $OpenBSD: log.h,v 1.2 2017/07/06 15:02:53 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
#include <stdarg.h>
#include <sys/cdefs.h>
+#ifndef SMALL
void log_init(int, int);
void log_procinit(const char *);
void log_setverbose(int);
__attribute__((__format__ (printf, 1, 2)));
__dead void fatalx(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
+#else
+#define log_init(x...) do {} while(0)
+#define log_procinit(x...) do {} while(0)
+#define log_setverbose(x...) do {} while(0)
+#define log_warn(x...) do {} while(0)
+#define log_warnx(x...) do {} while(0)
+#define log_info(x...) do {} while(0)
+#define log_debug(x...) do {} while(0)
+#define logit(x...) do {} while(0)
+#define vlog(x...) do {} while(0)
+#define fatal(x...) exit(1)
+#define fatalx(x...) exit(1)
+#endif /* SMALL */
#endif /* LOG_H */
-/* $OpenBSD: slaacd.c,v 1.3 2017/07/06 14:57:29 florian Exp $ */
+/* $OpenBSD: slaacd.c,v 1.4 2017/07/06 15:02:53 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
#include "engine.h"
#include "control.h"
+#ifndef SMALL
const char* imsg_type_name[] = {
"IMSG_NONE",
"IMSG_CTL_LOG_VERBOSE",
"IMSG_CONFIGURE_DFR",
"IMSG_WITHDRAW_DFR",
};
+#endif /* SMALL */
__dead void usage(void);
__dead void main_shutdown(void);
free(iev_frontend);
free(iev_engine);
+#ifndef SMALL
control_cleanup(csock);
+#endif /* SMALL */
log_info("terminating");
exit(0);
struct imsgbuf *ibuf;
struct imsg imsg;
ssize_t n;
- int shut = 0, verbose;
+ int shut = 0;
+#ifndef SMALL
+ int verbose;
+#endif /* SMALL */
ibuf = &iev->ibuf;
break;
switch (imsg.hdr.type) {
+#ifndef SMALL
case IMSG_CTL_LOG_VERBOSE:
/* Already checked by frontend. */
memcpy(&verbose, imsg.data, sizeof(verbose));
log_setverbose(verbose);
break;
+#endif /* SMALL */
default:
log_debug("%s: error handling imsg %d", __func__,
imsg.hdr.type);
-/* $OpenBSD: slaacd.h,v 1.4 2017/07/06 14:57:29 florian Exp $ */
+/* $OpenBSD: slaacd.h,v 1.5 2017/07/06 15:02:53 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
enum imsg_type {
IMSG_NONE,
+#ifndef SMALL
IMSG_CTL_LOG_VERBOSE,
IMSG_CTL_SHOW_INTERFACE_INFO,
IMSG_CTL_SHOW_INTERFACE_INFO_RA,
IMSG_CTL_SHOW_INTERFACE_INFO_DFR_PROPOSALS,
IMSG_CTL_SHOW_INTERFACE_INFO_DFR_PROPOSAL,
IMSG_CTL_END,
+#endif /* SMALL */
IMSG_CTL_SEND_SOLICITATION,
IMSG_SOCKET_IPC,
IMSG_STARTUP,
HIGH,
};
+#ifndef SMALL
struct ctl_engine_info {
uint32_t if_index;
int running;
uint32_t router_lifetime;
char rpref[sizeof("MEDIUM")];
};
+#endif /* SMALL */
struct imsg_ifinfo {
uint32_t if_index;