-/* $OpenBSD: dhcpd.c,v 1.41 2010/12/15 14:34:17 claudio Exp $ */
+/* $OpenBSD: dhcpd.c,v 1.42 2014/05/05 18:27:57 pelikan Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org>
if (setrtable(rdomain) == -1)
error("setrtable (%m)");
- icmp_startup(1, lease_pinged);
+ icmp_startup();
if (syncsend || syncrecv) {
syncfd = sync_init(sync_iface, sync_baddr, sync_port);
-/* $OpenBSD: dhcpd.h,v 1.47 2013/04/17 19:26:10 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.48 2014/05/05 18:27:57 pelikan Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
u_int32_t wrapsum(u_int32_t);
/* icmp.c */
-void icmp_startup(int, void (*)(struct iaddr, u_int8_t *, int));
-int icmp_echorequest(struct iaddr *);
-void icmp_echoreply(struct protocol *);
+void icmp_startup(void);
+int icmp_echorequest(struct iaddr *);
+void icmp_echoreply(struct protocol *);
/* pfutils.c */
__dead void pftable_handler(void);
-/* $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.
/* 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;
&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
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;
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);
}