projects
/
project
/
odhcpd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dhcpv6: fix calculation of T1 and T2
[project/odhcpd.git]
/
src
/
odhcpd.c
diff --git
a/src/odhcpd.c
b/src/odhcpd.c
index
794bbfc
..
0edf63e
100644
(file)
--- a/
src/odhcpd.c
+++ b/
src/odhcpd.c
@@
-49,6
+49,12
@@
static int rtnl_seq = 0;
static int urandom_fd = -1;
static int urandom_fd = -1;
+static void sighandler(_unused int signal)
+{
+ uloop_end();
+}
+
+
int main()
{
openlog("odhcpd", LOG_PERROR | LOG_PID, LOG_DAEMON);
int main()
{
openlog("odhcpd", LOG_PERROR | LOG_PID, LOG_DAEMON);
@@
-71,6
+77,8
@@
int main()
return 4;
signal(SIGUSR1, SIG_IGN);
return 4;
signal(SIGUSR1, SIG_IGN);
+ signal(SIGINT, sighandler);
+ signal(SIGTERM, sighandler);
if (init_router())
return 4;
if (init_router())
return 4;
@@
-172,7
+180,7
@@
ssize_t odhcpd_send(int socket, struct sockaddr_in6 *dest,
ssize_t sent = sendmsg(socket, &msg, MSG_DONTWAIT);
if (sent < 0)
ssize_t sent = sendmsg(socket, &msg, MSG_DONTWAIT);
if (sent < 0)
- syslog(LOG_
WARNING
, "Failed to send to %s%%%s (%s)",
+ syslog(LOG_
NOTICE
, "Failed to send to %s%%%s (%s)",
ipbuf, iface->ifname, strerror(errno));
else
syslog(LOG_DEBUG, "Sent %li bytes to %s%%%s",
ipbuf, iface->ifname, strerror(errno));
else
syslog(LOG_DEBUG, "Sent %li bytes to %s%%%s",
@@
-377,6
+385,11
@@
int odhcpd_register(struct odhcpd_event *event)
return uloop_fd_add(&event->uloop, ULOOP_READ);
}
return uloop_fd_add(&event->uloop, ULOOP_READ);
}
+void odhcpd_process(struct odhcpd_event *event)
+{
+ odhcpd_receive_packets(&event->uloop, 0);
+}
+
void odhcpd_urandom(void *data, size_t len)
{
read(urandom_fd, data, len);
void odhcpd_urandom(void *data, size_t len)
{
read(urandom_fd, data, len);