summaryrefslogtreecommitdiff
path: root/sbin/slaacd
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2017-08-21 14:44:27 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2017-08-21 14:44:27 +0000
commit2b288f74b7bd6de06b350449babf9d6c03783a84 (patch)
tree75344f83b777867e45de2c1d34ad158de0aeb82a /sbin/slaacd
parentae1b27ad0865287bdf72898d587d4d03fddaa6fe (diff)
Move sin6_to_str() to slaacd.c so that it can be used in more
places. While here do not compile it for the ramdisk.
Diffstat (limited to 'sbin/slaacd')
-rw-r--r--sbin/slaacd/engine.c19
-rw-r--r--sbin/slaacd/slaacd.c20
-rw-r--r--sbin/slaacd/slaacd.h17
3 files changed, 31 insertions, 25 deletions
diff --git a/sbin/slaacd/engine.c b/sbin/slaacd/engine.c
index c2e1dbcf5c1..6c660943e83 100644
--- a/sbin/slaacd/engine.c
+++ b/sbin/slaacd/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.12 2017/08/18 07:45:03 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.13 2017/08/21 14:44:26 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -67,7 +67,6 @@
#include <errno.h>
#include <event.h>
#include <imsg.h>
-#include <netdb.h>
#include <pwd.h>
#include <signal.h>
#include <stddef.h>
@@ -258,7 +257,6 @@ void find_prefix(struct slaacd_iface *, struct
radv_prefix **);
int engine_imsg_compose_main(int, pid_t, void *, uint16_t);
uint32_t real_lifetime(struct timespec *, uint32_t);
-const char *sin6_to_str(struct sockaddr_in6 *);
struct imsgev *iev_frontend;
struct imsgev *iev_main;
@@ -2190,18 +2188,3 @@ real_lifetime(struct timespec *received_uptime, uint32_t ltime)
return (remaining);
}
-
-const char*
-sin6_to_str(struct sockaddr_in6 *sin6)
-{
- static char hbuf[NI_MAXHOST];
- int error;
-
- error = getnameinfo((struct sockaddr *)sin6, sin6->sin6_len, hbuf,
- sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV);
- if (error) {
- log_warnx("%s", gai_strerror(error));
- strlcpy(hbuf, "unknown", sizeof(hbuf));
- }
- return hbuf;
-}
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index 8228a316f3a..84538bdc1bc 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.8 2017/08/19 11:14:04 florian Exp $ */
+/* $OpenBSD: slaacd.c,v 1.9 2017/08/21 14:44:26 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -36,6 +36,7 @@
#include <errno.h>
#include <event.h>
#include <imsg.h>
+#include <netdb.h>
#include <pwd.h>
#include <stddef.h>
#include <stdio.h>
@@ -799,3 +800,20 @@ delete_gateway(struct imsg_configure_dfr *dfr)
{
configure_gateway(dfr, RTM_DELETE);
}
+
+#ifndef SMALL
+const char*
+sin6_to_str(struct sockaddr_in6 *sin6)
+{
+ static char hbuf[NI_MAXHOST];
+ int error;
+
+ error = getnameinfo((struct sockaddr *)sin6, sin6->sin6_len, hbuf,
+ sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV);
+ if (error) {
+ log_warnx("%s", gai_strerror(error));
+ strlcpy(hbuf, "unknown", sizeof(hbuf));
+ }
+ return hbuf;
+}
+#endif /* SMALL */
diff --git a/sbin/slaacd/slaacd.h b/sbin/slaacd/slaacd.h
index 056ec296351..7bd7bc25d51 100644
--- a/sbin/slaacd/slaacd.h
+++ b/sbin/slaacd/slaacd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.h,v 1.7 2017/08/18 07:45:03 florian Exp $ */
+/* $OpenBSD: slaacd.h,v 1.8 2017/08/21 14:44:26 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -182,8 +182,13 @@ struct imsg_ra {
extern uint32_t cmd_opts;
/* slaacd.c */
-int main_imsg_compose_frontend(int, pid_t, void *, uint16_t);
-int main_imsg_compose_engine(int, pid_t, void *, uint16_t);
-void imsg_event_add(struct imsgev *);
-int imsg_compose_event(struct imsgev *, uint16_t, uint32_t, pid_t,
- int, void *, uint16_t);
+int main_imsg_compose_frontend(int, pid_t, void *, uint16_t);
+int main_imsg_compose_engine(int, pid_t, void *, uint16_t);
+void imsg_event_add(struct imsgev *);
+int imsg_compose_event(struct imsgev *, uint16_t, uint32_t, pid_t,
+ int, void *, uint16_t);
+#ifndef SMALL
+const char *sin6_to_str(struct sockaddr_in6 *);
+#else
+#define sin6_to_str(x...) ""
+#endif /* SMALL */