summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcpd/icmp.c
diff options
context:
space:
mode:
authorMartin Pelikan <pelikan@cvs.openbsd.org>2014-05-05 18:27:58 +0000
committerMartin Pelikan <pelikan@cvs.openbsd.org>2014-05-05 18:27:58 +0000
commitcf960822af1a7d706b772f6f1b4c3fe03e7460cf (patch)
tree1ebd519fc2bbb34c51efb86cf0fff1023f989c32 /usr.sbin/dhcpd/icmp.c
parent28ae172f52c858524cce8b50a6983bf05f6070b7 (diff)
Don't call the ICMP handler indirectly + clean up a bit.
ok krw
Diffstat (limited to 'usr.sbin/dhcpd/icmp.c')
-rw-r--r--usr.sbin/dhcpd/icmp.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/usr.sbin/dhcpd/icmp.c b/usr.sbin/dhcpd/icmp.c
index d96fc6b324b..7f7a361df61 100644
--- a/usr.sbin/dhcpd/icmp.c
+++ b/usr.sbin/dhcpd/icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp.c,v 1.10 2008/09/15 20:38:17 claudio Exp $ */
+/* $OpenBSD: icmp.c,v 1.11 2014/05/05 18:27:57 pelikan Exp $ */
/*
* Copyright (c) 1997, 1998 The Internet Software Consortium.
@@ -49,7 +49,7 @@ static int icmp_protocol_fd;
/* Initialize the ICMP protocol. */
void
-icmp_startup(int routep, void (*handler)(struct iaddr, u_int8_t *, int))
+icmp_startup(void)
{
struct protoent *proto;
int protocol = 1, state;
@@ -73,7 +73,7 @@ icmp_startup(int routep, void (*handler)(struct iaddr, u_int8_t *, int))
&state, sizeof(state)) == -1)
error("Unable to disable SO_DONTROUTE on ICMP socket: %m");
- add_protocol("icmp", icmp_protocol_fd, icmp_echoreply, (void *)handler);
+ add_protocol("icmp", icmp_protocol_fd, icmp_echoreply, NULL);
}
int
@@ -114,7 +114,6 @@ icmp_echorequest(struct iaddr *addr)
void
icmp_echoreply(struct protocol *protocol)
{
- void (*handler)(struct iaddr, u_int8_t *, int);
struct sockaddr_in from;
u_int8_t icbuf[1500];
struct icmp *icfrom;
@@ -141,12 +140,7 @@ icmp_echoreply(struct protocol *protocol)
if (icfrom->icmp_type != ICMP_ECHOREPLY)
return;
- /* If we were given a second-stage handler, call it. */
- if (protocol->local) {
- handler = ((void (*)(struct iaddr, u_int8_t *, int))
- protocol->local);
- memcpy(ia.iabuf, &from.sin_addr, sizeof from.sin_addr);
- ia.len = sizeof from.sin_addr;
- (*handler)(ia, icbuf, len);
- }
+ memcpy(ia.iabuf, &from.sin_addr, sizeof from.sin_addr);
+ ia.len = sizeof from.sin_addr;
+ lease_pinged(ia, icbuf, len);
}