aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/choparp
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-07-19 12:00:16 +0000
committerRenato Botelho <garga@FreeBSD.org>2015-07-19 12:00:16 +0000
commitea8a2007b980e58bdb2a26d47079d54cefff1c68 (patch)
treeb93ff2581d4fdbebb387a930e7d31c2e583e95e9 /net-mgmt/choparp
parentec63f5f84cb50e24347c571f4b415b032ada8ed6 (diff)
downloadports-ea8a2007b980e58bdb2a26d47079d54cefff1c68.tar.gz
ports-ea8a2007b980e58bdb2a26d47079d54cefff1c68.zip
Update to 20150613
Note this version uses pcap instead of bpf Sponsored by: Netgate
Notes
Notes: svn path=/head/; revision=392497
Diffstat (limited to 'net-mgmt/choparp')
-rw-r--r--net-mgmt/choparp/Makefile19
-rw-r--r--net-mgmt/choparp/distinfo4
-rw-r--r--net-mgmt/choparp/files/patch-Makefile14
-rw-r--r--net-mgmt/choparp/files/patch-choparp.856
-rw-r--r--net-mgmt/choparp/files/patch-choparp.c135
-rw-r--r--net-mgmt/choparp/pkg-descr2
6 files changed, 19 insertions, 211 deletions
diff --git a/net-mgmt/choparp/Makefile b/net-mgmt/choparp/Makefile
index 44fed991c178..8793ea164e7a 100644
--- a/net-mgmt/choparp/Makefile
+++ b/net-mgmt/choparp/Makefile
@@ -2,18 +2,31 @@
# $FreeBSD$
PORTNAME= choparp
-PORTVERSION= 20021107
-PORTREVISION= 4
+PORTVERSION= 20150613
CATEGORIES= net-mgmt
-MASTER_SITES= SF
+MASTER_SITES= GH
MAINTAINER= garga@FreeBSD.org
COMMENT= Simple proxy arp daemon
LICENSE= BSD3CLAUSE
+USE_GITHUB= yes
+GH_ACCOUNT= quinot
+GH_TAGNAME= release/${PORTVERSION}
USE_RC_SUBR= choparp
+LDFLAGS+= -lpcap
PLIST_FILES= sbin/choparp man/man8/choparp.8.gz
+do-build:
+ ( cd ${WRKSRC}/src && \
+ ${CC} ${CFLAGS} ${LDFLAGS} -o ${PORTNAME} ${PORTNAME}.c )
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/src/${PORTNAME} \
+ ${STAGEDIR}${PREFIX}/sbin
+ ${INSTALL_MAN} ${WRKSRC}/src/${PORTNAME}.8 \
+ ${STAGEDIR}${MAN8PREFIX}/man/man8
+
.include <bsd.port.mk>
diff --git a/net-mgmt/choparp/distinfo b/net-mgmt/choparp/distinfo
index cc2ae810e695..d81fc35ed3fd 100644
--- a/net-mgmt/choparp/distinfo
+++ b/net-mgmt/choparp/distinfo
@@ -1,2 +1,2 @@
-SHA256 (choparp-20021107.tar.gz) = 3a79c98868b87513dee19805a00d1262907e42dbca6e688f1550870fa02acd7c
-SIZE (choparp-20021107.tar.gz) = 6687
+SHA256 (quinot-choparp-20150613-release-20150613_GH0.tar.gz) = 141cad384dc42f094d0c9a1fd49440adc1bf7f19c1cce122091374d8ca261f19
+SIZE (quinot-choparp-20150613-release-20150613_GH0.tar.gz) = 6506
diff --git a/net-mgmt/choparp/files/patch-Makefile b/net-mgmt/choparp/files/patch-Makefile
deleted file mode 100644
index 4b605bc8368b..000000000000
--- a/net-mgmt/choparp/files/patch-Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
---- Makefile.orig 2015-06-07 13:12:33 UTC
-+++ Makefile
-@@ -0,0 +1,11 @@
-+PROG= choparp
-+MAN8= choparp.8
-+
-+BINOWN!= /usr/bin/id -n -u
-+BINGRP!= /usr/bin/id -n -g
-+MANOWN= ${BINOWN}
-+MANGRP= ${BINGRP}
-+BINDIR= ${PREFIX}/sbin
-+MANDIR= ${PREFIX}/man/man
-+
-+.include <bsd.prog.mk>
diff --git a/net-mgmt/choparp/files/patch-choparp.8 b/net-mgmt/choparp/files/patch-choparp.8
deleted file mode 100644
index be9f352272b4..000000000000
--- a/net-mgmt/choparp/files/patch-choparp.8
+++ /dev/null
@@ -1,56 +0,0 @@
---- choparp.8.orig 2002-11-07 22:36:03 UTC
-+++ choparp.8
-@@ -34,7 +34,8 @@
- .Nm choparp
- .Nd cheap and omitted proxy ARP
- .Sh SYNOPSIS
--.Nm chpoarp
-+.Nm choparp
-+.Op Fl v
- .Ar if_name mac_addr
- .Oo Fl Oc Ns Ar net_addr Ns
- .Op / Ns Ar net_mask
-@@ -42,7 +43,7 @@
- .Sh DESCRIPTION
- .Pp
- .Nm choparp
--is a easy-to-use proxy ARP daemon.
-+is an easy-to-use proxy ARP daemon.
- It watches ARP request packets visible on the interface specified by argument
- .Ar if_name ,
- and sends proxy ARP reply to the sender if the ARP request queries the
-@@ -52,7 +53,7 @@ for the network specified by
- .Ar net_addr Ns / Ar net_mask .
- .Pp
- .Ar mac_addr
--is th MAC address to be published for the specified hosts.
-+is the MAC address to be published for the specified hosts.
- It is normally the address of
- .Ar if_name .
- The format of
-@@ -72,7 +73,7 @@ or be a 32 bit hexadecimal value startin
- .Dq 0x
- .Pq for example Ad 0x858a0186 .
- .Ar net_mask
--can likewise be speficied as a dotted quad or hexadecimal value,
-+can likewise be specified as a dotted quad or hexadecimal value,
- or alternatively as a mask length. The following address specifications
- are therefore equivalent:
- .Bl -item -offset indent
-@@ -89,6 +90,16 @@ Addresses can be
- .Em excluded
- by preceding them with
- .Fl
-+.Pp
-+.Fl v
-+option enables verbose mode, showing warning for invalid ARP packets.
-+.Pp
-+.Nm choparp
-+uses the Berkeley Packet Filter
-+.Nm bpf(4)
-+and so the kernel must be compiled with support for the
-+.Nm bpf
-+device.
- .Sh EXAMPLES
- If you have network interface
- .Dq ne0
diff --git a/net-mgmt/choparp/files/patch-choparp.c b/net-mgmt/choparp/files/patch-choparp.c
deleted file mode 100644
index 1d28ecdb38c1..000000000000
--- a/net-mgmt/choparp/files/patch-choparp.c
+++ /dev/null
@@ -1,135 +0,0 @@
---- choparp.c.orig 2002-11-07 22:36:03 UTC
-+++ choparp.c
-@@ -42,6 +42,7 @@
- #include <string.h>
- #include <sys/types.h>
- #include <fcntl.h>
-+#include <sys/event.h>
- #include <sys/time.h>
- #include <sys/ioctl.h>
- #include <net/bpf.h>
-@@ -75,6 +76,7 @@ struct cidr {
-
- struct cidr *targets = NULL, *excludes = NULL;
- u_char target_mac[ETHER_ADDR_LEN]; /* target MAC address */
-+int verbose = 0;
-
- /*
- ARP filter program
-@@ -239,6 +241,16 @@ checkarp(char *arpbuf){
- fprintf(stderr,"checkarp: WARNING: received unknown type ARP request.\n");
- return(0);
- }
-+ if (ntohl(*(u_int32_t *)(arp->arp_tpa)) == ntohl(*(u_int32_t *)(arp->arp_spa))) {
-+ if (verbose != 0)
-+ fprintf(stderr,"checkarp: WARNING: sender equal dest.\n");
-+ return(0);
-+ }
-+ if (0 == ntohl(*(u_int32_t *)(arp->arp_spa))) {
-+ if (verbose != 0)
-+ fprintf(stderr,"checkarp: WARNING: zero sender address.\n");
-+ return(0);
-+ }
- target_ip = ntohl(*(u_int32_t *)(arp->arp_tpa));
- return match(target_ip, targets) && !match(target_ip, excludes);
- }
-@@ -280,13 +292,22 @@ loop(int fd, char *buf, size_t buflen){
- char *rframe;
- char *sframe;
- size_t frame_len;
-- fd_set fdset;
-+ int kq;
-+ struct kevent kev;
-
-- FD_ZERO(&fdset);
-- FD_SET(fd,&fdset);
-+ if ((kq = kqueue()) < 0) {
-+ perror("kqueue");
-+ return;
-+ }
-+
-+ EV_SET(&kev, fd, EVFILT_READ, EV_ADD, 0, 0, NULL);
-+ if (kevent(kq, &kev, 1, NULL, 0, NULL) < 0 ) {
-+ perror("kevent");
-+ return;
-+ }
-
- for(;;){
-- int r = select(fd+1,&fdset, 0, 0, 0);
-+ int r = kevent(kq, NULL, 0, &kev, 1, NULL);
-
- if (r < 0) {
- if (errno == EINTR)
-@@ -295,7 +316,7 @@ loop(int fd, char *buf, size_t buflen){
- return;
- }
-
-- rlen = read(fd, buf, buflen);
-+ rlen = read(kev.ident, buf, buflen);
- if (rlen < 0) {
- if (errno == EINTR)
- continue;
-@@ -307,7 +328,7 @@ loop(int fd, char *buf, size_t buflen){
- while((rframe = getarp(p, rlen, &nextp, &nextlen)) != NULL){
- if (checkarp(rframe)){
- sframe = gen_arpreply(rframe, &frame_len);
-- write(fd, sframe, frame_len);
-+ write(kev.ident, sframe, frame_len);
- }
- p = nextp;
- rlen = nextlen;
-@@ -362,13 +383,13 @@ atoip(char *buf, u_int32_t *ip_addr){
-
- void
- usage(void){
-- fprintf(stderr,"usage: choparp if_name mac_addr [-]addr/mask...\n");
-+ fprintf(stderr,"usage: choparp [-v] if_name mac_addr [-]addr/mask...\n");
- exit(-1);
- }
-
- int
- main(int argc, char **argv){
-- int fd;
-+ int ch, fd;
- char *buf, *ifname;
- struct cidr **targets_tail = &targets, **excludes_tail = &excludes;
- #define APPEND(LIST,ADDR,MASK) \
-@@ -381,13 +402,24 @@ main(int argc, char **argv){
- } while (0)
- size_t buflen;
-
-- if (argc < 4)
-+ while ((ch = getopt(argc, argv, "v")) != -1)
-+ switch (ch) {
-+ case 'v':
-+ verbose++;
-+ break;
-+ default:
-+ usage();
-+ }
-+ argc -= optind;
-+ argv += optind;
-+
-+ if (argc < 3)
- usage();
-
-- ifname = argv[1];
-- if (setmac(argv[2], ifname))
-+ ifname = argv[0];
-+ if (setmac(argv[1], ifname))
- usage();
-- argv += 3; argc -= 3;
-+ argv += 2; argc -= 2;
-
- while (argc > 0) {
- u_int32_t addr, mask = ~0;
-@@ -437,6 +469,9 @@ main(int argc, char **argv){
- #endif
- if ((fd = openbpf(ifname, &buf, &buflen)) < 0)
- return(-1);
-+ #ifndef DEBUG
-+ daemon(0, 0);
-+ #endif
- loop(fd, buf, buflen);
- return(-1);
- }
diff --git a/net-mgmt/choparp/pkg-descr b/net-mgmt/choparp/pkg-descr
index ff7cecfd5b23..b6be3b1707df 100644
--- a/net-mgmt/choparp/pkg-descr
+++ b/net-mgmt/choparp/pkg-descr
@@ -4,4 +4,4 @@ proxy arp reply to the sender if the arp request queries the MAC address
(ethernet hardware address) for the network speicified by net_addr and
net_mask.
-WWW: http://sourceforge.net/projects/choparp/
+WWW: https://github.com/quinot/choparp