Thu May 23 15:46:11 2013 UTC ()
avoid deprecated event_gotsig and friends.


(christos)
diff -r1.27 -r1.28 pkgsrc/security/honeyd-arpd/Makefile
diff -r1.3 -r1.4 pkgsrc/security/honeyd-arpd/distinfo
diff -r1.2 -r1.3 pkgsrc/security/honeyd-arpd/patches/patch-ab

cvs diff -r1.27 -r1.28 pkgsrc/security/honeyd-arpd/Makefile (expand / switch to unified diff)

--- pkgsrc/security/honeyd-arpd/Makefile 2013/02/06 23:23:37 1.27
+++ pkgsrc/security/honeyd-arpd/Makefile 2013/05/23 15:46:11 1.28
@@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
1# $NetBSD: Makefile,v 1.27 2013/02/06 23:23:37 jperkin Exp $ 1# $NetBSD: Makefile,v 1.28 2013/05/23 15:46:11 christos Exp $
2# 2#
3 3
4DISTNAME= arpd-0.2 4DISTNAME= arpd-0.2
5PKGNAME= honeyd-arpd-0.2 5PKGNAME= honeyd-arpd-0.2
6PKGREVISION= 15 6PKGREVISION= 16
7CATEGORIES= security net 7CATEGORIES= security net
8MASTER_SITES= http://niels.xtdnet.nl/honeyd/ 8MASTER_SITES= http://niels.xtdnet.nl/honeyd/
9 9
10MAINTAINER= pkgsrc-users@NetBSD.org 10MAINTAINER= pkgsrc-users@NetBSD.org
11HOMEPAGE= http://niels.xtdnet.nl/honeyd/ 11HOMEPAGE= http://niels.xtdnet.nl/honeyd/
12COMMENT= ARP daemon for honeyd 12COMMENT= ARP daemon for honeyd
13 13
14RCD_SCRIPTS= honeydarpd 14RCD_SCRIPTS= honeydarpd
15GNU_CONFIGURE= yes 15GNU_CONFIGURE= yes
16WRKSRC= ${WRKDIR}/arpd 16WRKSRC= ${WRKDIR}/arpd
17 17
18CONFIGURE_ARGS+= --with-libevent=${BUILDLINK_PREFIX.libevent} 18CONFIGURE_ARGS+= --with-libevent=${BUILDLINK_PREFIX.libevent}
19 19

cvs diff -r1.3 -r1.4 pkgsrc/security/honeyd-arpd/distinfo (expand / switch to unified diff)

--- pkgsrc/security/honeyd-arpd/distinfo 2006/01/20 01:06:22 1.3
+++ pkgsrc/security/honeyd-arpd/distinfo 2013/05/23 15:46:11 1.4
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
1$NetBSD: distinfo,v 1.3 2006/01/20 01:06:22 joerg Exp $ 1$NetBSD: distinfo,v 1.4 2013/05/23 15:46:11 christos Exp $
2 2
3SHA1 (arpd-0.2.tar.gz) = e827ada394aff91f9c539cee35e946e81152426c 3SHA1 (arpd-0.2.tar.gz) = e827ada394aff91f9c539cee35e946e81152426c
4RMD160 (arpd-0.2.tar.gz) = 777ef6789e2882cf0e0958951377f65f6362d816 4RMD160 (arpd-0.2.tar.gz) = 777ef6789e2882cf0e0958951377f65f6362d816
5Size (arpd-0.2.tar.gz) = 49437 bytes 5Size (arpd-0.2.tar.gz) = 49437 bytes
6SHA1 (patch-aa) = 5f89c08d7d93a6f47cde95b6a139695c6ad1e694 6SHA1 (patch-aa) = 5f89c08d7d93a6f47cde95b6a139695c6ad1e694
7SHA1 (patch-ab) = c23bed6c274ba8559f1f715a5e5c6892057253d2 7SHA1 (patch-ab) = 7d6f1395a8b2da23f4ba617a9d3421ed5677846a

cvs diff -r1.2 -r1.3 pkgsrc/security/honeyd-arpd/patches/patch-ab (expand / switch to unified diff)

--- pkgsrc/security/honeyd-arpd/patches/patch-ab 2006/01/20 01:06:22 1.2
+++ pkgsrc/security/honeyd-arpd/patches/patch-ab 2013/05/23 15:46:11 1.3
@@ -1,53 +1,117 @@ @@ -1,53 +1,117 @@
1$NetBSD: patch-ab,v 1.2 2006/01/20 01:06:22 joerg Exp $ 1$NetBSD: patch-ab,v 1.3 2013/05/23 15:46:11 christos Exp $
2 2
3--- arpd.c.orig 2003-02-09 04:20:40.000000000 +0000 3--- arpd.c.orig 2003-02-08 23:20:40.000000000 -0500
4+++ arpd.c 4+++ arpd.c 2013-05-23 11:43:08.000000000 -0400
5@@ -33,7 +33,7 @@ 5@@ -33,7 +33,7 @@
6 #define ARPD_MAX_ACTIVE 600 6 #define ARPD_MAX_ACTIVE 600
7 #define ARPD_MAX_INACTIVE 300 7 #define ARPD_MAX_INACTIVE 300
8  8
9-#define PIDFILE "/var/run/arpd.pid" 9-#define PIDFILE "/var/run/arpd.pid"
10+#define PIDFILE "/var/run/honeyd-arpd.pid" 10+#define PIDFILE "/var/run/honeyd-arpd.pid"
11  11
12 struct arp_req { 12 struct arp_req {
13 struct addr pa; 13 struct addr pa;
14@@ -265,7 +265,7 @@ arpd_send(eth_t *eth, int op, 14@@ -65,7 +65,6 @@
 15 static arp_t *arpd_arp;
 16 static eth_t *arpd_eth;
 17 static struct intf_entry arpd_ifent;
 18-static int arpd_sig;
 19
 20 static void
 21 usage(void)
 22@@ -265,7 +264,7 @@
15 spa->addr_ip, tha->addr_eth, tpa->addr_ip); 23 spa->addr_ip, tha->addr_eth, tpa->addr_ip);
16  24
17 if (op == ARP_OP_REQUEST) { 25 if (op == ARP_OP_REQUEST) {
18- syslog(LOG_DEBUG, __FUNCTION__ ": who-has %s tell %s", 26- syslog(LOG_DEBUG, __FUNCTION__ ": who-has %s tell %s",
19+ syslog(LOG_DEBUG, "%s: who-has %s tell %s", __FUNCTION__, 27+ syslog(LOG_DEBUG, "%s: who-has %s tell %s", __FUNCTION__,
20 addr_ntoa(tpa), addr_ntoa(spa)); 28 addr_ntoa(tpa), addr_ntoa(spa));
21 } else if (op == ARP_OP_REPLY) { 29 } else if (op == ARP_OP_REPLY) {
22 syslog(LOG_INFO, "arp reply %s is-at %s", 30 syslog(LOG_INFO, "arp reply %s is-at %s",
23@@ -282,7 +282,7 @@ arpd_lookup(struct addr *addr) 31@@ -282,7 +281,7 @@
24 int error; 32 int error;
25  33
26 if (addr_cmp(addr, &arpd_ifent.intf_addr) == 0) { 34 if (addr_cmp(addr, &arpd_ifent.intf_addr) == 0) {
27- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", 35- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
28+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, 36+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
29 addr_ntoa(addr), addr_ntoa(&arpd_ifent.intf_link_addr)); 37 addr_ntoa(addr), addr_ntoa(&arpd_ifent.intf_link_addr));
30 return (0); 38 return (0);
31 } 39 }
32@@ -291,10 +291,10 @@ arpd_lookup(struct addr *addr) 40@@ -291,10 +290,10 @@
33 error = arp_get(arpd_arp, &arpent); 41 error = arp_get(arpd_arp, &arpent);
34  42
35 if (error == -1) { 43 if (error == -1) {
36- syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s", 44- syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s",
37+ syslog(LOG_DEBUG, "%s: no entry for %s", __FUNCTION__, 45+ syslog(LOG_DEBUG, "%s: no entry for %s", __FUNCTION__,
38 addr_ntoa(addr)); 46 addr_ntoa(addr));
39 } else { 47 } else {
40- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", 48- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
41+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, 49+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
42 addr_ntoa(addr), addr_ntoa(&arpent.arp_ha)); 50 addr_ntoa(addr), addr_ntoa(&arpent.arp_ha));
43 } 51 }
44 return (error); 52 return (error);
45@@ -423,7 +423,7 @@ arpd_recv_cb(u_char *u, const struct pca 53@@ -423,7 +422,7 @@
46 if ((req = SPLAY_FIND(tree, &arpd_reqs, &tmp)) != NULL) { 54 if ((req = SPLAY_FIND(tree, &arpd_reqs, &tmp)) != NULL) {
47 addr_pack(&src.arp_ha, ADDR_TYPE_ETH, ETH_ADDR_BITS, 55 addr_pack(&src.arp_ha, ADDR_TYPE_ETH, ETH_ADDR_BITS,
48 ethip->ar_sha, ETH_ADDR_LEN); 56 ethip->ar_sha, ETH_ADDR_LEN);
49- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", 57- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
50+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, 58+ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
51 addr_ntoa(&req->pa), addr_ntoa(&src.arp_ha)); 59 addr_ntoa(&req->pa), addr_ntoa(&src.arp_ha));
52  60
53 /* This address is claimed */ 61 /* This address is claimed */
 62@@ -442,22 +441,23 @@
 63 syslog(LOG_ERR, "pcap_dispatch: %s", pcap_geterr(arpd_pcap));
 64 }
 65
 66-void
 67-terminate_handler(int sig)
 68-{
 69- extern int event_gotsig;
 70-
 71- event_gotsig = 1;
 72- arpd_sig = sig;
 73-}
 74+static void
 75+arpd_signal(evutil_socket_t fd, short what, void *arg)
 76
 77-int
 78-arpd_signal(void)
 79 {
 80+ int arpd_sig;
 81+ recv(fd, &arpd_sig, sizeof(arpd_sig), 0);
 82 syslog(LOG_INFO, "exiting on signal %d", arpd_sig);
 83 arpd_exit(0);
 84- /* NOTREACHED */
 85- return (-1);
 86+}
 87+
 88+static void
 89+addsignal(int sig) {
 90+ struct event sig_ev;
 91+ int got;
 92+
 93+ evsignal_set(&sig_ev, sig, arpd_signal, &got);
 94+ evsignal_add(&sig_ev, NULL);
 95 }
 96
 97 int
 98@@ -516,16 +516,9 @@
 99 event_add(&recv_ev, NULL);
 100
 101 /* Setup signal handler */
 102- if (signal(SIGINT, terminate_handler) == SIG_ERR) {
 103- perror("signal");
 104- return (-1);
 105- }
 106- if (signal(SIGTERM, terminate_handler) == SIG_ERR) {
 107- perror("signal");
 108- return (-1);
 109- }
 110- event_sigcb = arpd_signal;
 111-
 112+ addsignal(SIGINT);
 113+ addsignal(SIGTERM);
 114+
 115 event_dispatch();
 116
 117 return (0);