openbsd-ports/net/arpd/patches/patch-arpd_c
2005-04-30 12:59:58 +00:00

104 lines
3.2 KiB
Plaintext

$OpenBSD: patch-arpd_c,v 1.3 2005/04/30 12:59:58 alek Exp $
--- arpd.c.orig Sun Feb 9 05:20:40 2003
+++ arpd.c Sat Apr 30 14:45:52 2005
@@ -22,10 +22,6 @@
#include <syslog.h>
#include <unistd.h>
-/* XXX - libevent */
-#undef timeout_pending
-#undef timeout_initialized
-
#include <event.h>
#include <dnet.h>
#include "tree.h"
@@ -265,7 +261,7 @@ arpd_send(eth_t *eth, int op,
spa->addr_ip, tha->addr_eth, tpa->addr_ip);
if (op == ARP_OP_REQUEST) {
- syslog(LOG_DEBUG, __FUNCTION__ ": who-has %s tell %s",
+ syslog(LOG_DEBUG, "%s: who-has %s tell %s", __FUNCTION__,
addr_ntoa(tpa), addr_ntoa(spa));
} else if (op == ARP_OP_REPLY) {
syslog(LOG_INFO, "arp reply %s is-at %s",
@@ -282,7 +278,7 @@ arpd_lookup(struct addr *addr)
int error;
if (addr_cmp(addr, &arpd_ifent.intf_addr) == 0) {
- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
addr_ntoa(addr), addr_ntoa(&arpd_ifent.intf_link_addr));
return (0);
}
@@ -291,10 +287,10 @@ arpd_lookup(struct addr *addr)
error = arp_get(arpd_arp, &arpent);
if (error == -1) {
- syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s",
+ syslog(LOG_DEBUG, "%s: no entry for %s", __FUNCTION__,
addr_ntoa(addr));
} else {
- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
addr_ntoa(addr), addr_ntoa(&arpent.arp_ha));
}
return (error);
@@ -303,9 +299,9 @@ arpd_lookup(struct addr *addr)
static void
arpd_free(struct arp_req *req)
{
- timeout_del(&req->active);
- timeout_del(&req->inactive);
- timeout_del(&req->discover);
+ evtimer_del(&req->active);
+ evtimer_del(&req->inactive);
+ evtimer_del(&req->discover);
free(req);
}
@@ -331,7 +327,7 @@ arpd_discover(struct arp_req *req, struc
arpd_send(arpd_eth, ARP_OP_REQUEST,
&arpd_ifent.intf_link_addr,
&arpd_ifent.intf_addr, &req->ha, &req->pa);
- timeout_add(&req->discover, &tv);
+ evtimer_add(&req->discover, &tv);
}
req->cnt++;
}
@@ -378,13 +374,13 @@ arpd_recv_cb(u_char *u, const struct pca
}
memcpy(&req->pa, &tmp.pa, sizeof(tmp.pa));
- timeout_set(&req->active, arpd_timeout, req);
- timeout_set(&req->inactive, arpd_timeout, req);
- timeout_set(&req->discover, arpd_discovercb, req);
+ evtimer_set(&req->active, arpd_timeout, req);
+ evtimer_set(&req->inactive, arpd_timeout, req);
+ evtimer_set(&req->discover, arpd_discovercb, req);
timerclear(&tv);
tv.tv_sec = ARPD_MAX_ACTIVE;
- timeout_add(&req->active, &tv);
+ evtimer_add(&req->active, &tv);
SPLAY_INSERT(tree, &arpd_reqs, req);
@@ -396,7 +392,7 @@ arpd_recv_cb(u_char *u, const struct pca
} else {
timerclear(&tv);
tv.tv_sec = ARPD_MAX_INACTIVE;
- timeout_add(&req->inactive, &tv);
+ evtimer_add(&req->inactive, &tv);
if (req->negative) {
syslog(LOG_DEBUG, "%s: %s is allocated",
@@ -423,7 +419,7 @@ arpd_recv_cb(u_char *u, const struct pca
if ((req = SPLAY_FIND(tree, &arpd_reqs, &tmp)) != NULL) {
addr_pack(&src.arp_ha, ADDR_TYPE_ETH, ETH_ADDR_BITS,
ethip->ar_sha, ETH_ADDR_LEN);
- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
addr_ntoa(&req->pa), addr_ntoa(&src.arp_ha));
/* This address is claimed */