update to libdnet-1.7; from Srebrenko Sehic <haver@insecure.dk>,

give MAINTAINER
This commit is contained in:
jsyn 2003-04-08 00:59:33 +00:00
parent 3c38c2373b
commit 7420b438fe
4 changed files with 8 additions and 130 deletions

View File

@ -1,14 +1,14 @@
# $OpenBSD: Makefile,v 1.5 2003/01/27 17:07:51 naddy Exp $ # $OpenBSD: Makefile,v 1.6 2003/04/08 00:59:33 jsyn Exp $
COMMENT= "portable low-level networking library" COMMENT= "portable low-level networking library"
DISTNAME= libdnet-1.5 DISTNAME= libdnet-1.7
CATEGORIES= net CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=libdnet/} MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=libdnet/}
HOMEPAGE= http://libdnet.sourceforge.net/ HOMEPAGE= http://libdnet.sourceforge.net/
MAINTAINER= Dug Song <dugsong@monkey.org> MAINTAINER= Srebrenko Sehic <haver@insecure.dk>
# BSD # BSD
PERMIT_PACKAGE_CDROM= Yes PERMIT_PACKAGE_CDROM= Yes

View File

@ -1,3 +1,3 @@
MD5 (libdnet-1.5.tar.gz) = 378c10adefc3ce5333af8f3ee47385cc MD5 (libdnet-1.7.tar.gz) = e0680e7375dd733f50466fcd4ac5e203
RMD160 (libdnet-1.5.tar.gz) = b98df160b0e7c6b75931622cb40f6152d17eb450 RMD160 (libdnet-1.7.tar.gz) = d9a0e15208a4a39b66ddb09da918860ac9ef5a35
SHA1 (libdnet-1.5.tar.gz) = 89b692c772565cb16d9935a6dac8bc288baf440a SHA1 (libdnet-1.7.tar.gz) = 1bb75c39eed7351144a3d3f664161d9cc7cf8283

View File

@ -1,123 +0,0 @@
$OpenBSD: patch-src_fw-pf_c,v 1.4 2003/01/27 17:07:51 naddy Exp $
--- src/fw-pf.c.orig Tue May 14 08:54:30 2002
+++ src/fw-pf.c Mon Jan 27 17:40:39 2003
@@ -26,9 +26,29 @@
#include "dnet.h"
-#ifdef PF_RULE_LABEL_SIZE
-/* XXX */
-#define addr addr.addr
+/*
+ * XXX - cope with moving pf API
+ * $OpenBSD: patch-src_fw-pf_c,v 1.4 2003/01/27 17:07:51 naddy Exp $
+ * $OpenBSD: patch-src_fw-pf_c,v 1.4 2003/01/27 17:07:51 naddy Exp $
+ * $OpenBSD: patch-src_fw-pf_c,v 1.4 2003/01/27 17:07:51 naddy Exp $
+ */
+#if defined(DIOCRINABEGIN)
+# define PFRA_ADDR(ra) (ra)->addr.v.a.addr.v4.s_addr
+# define PFRA_MASK(ra) (ra)->addr.v.a.mask.v4.s_addr
+# define pfioc_changerule pfioc_rule
+# define oldrule rule
+# define newrule rule
+#elif defined(DIOCBEGINADDRS)
+# define PFRA_ADDR(ra) (ra)->addr.addr.v4.s_addr
+# define PFRA_MASK(ra) (ra)->addr.mask.v4.s_addr
+#elif defined(PFRULE_FRAGMENT)
+/* OpenBSD 3.2 */
+# define PFRA_ADDR(ra) (ra)->addr.addr.v4.s_addr
+# define PFRA_MASK(ra) (ra)->mask.v4.s_addr
+#else
+/* OpenBSD 3.1 */
+# define PFRA_ADDR(ra) (ra)->addr.v4.s_addr
+# define PFRA_MASK(ra) (ra)->mask.v4.s_addr
#endif
struct fw_handle {
@@ -47,11 +67,11 @@ fr_to_pr(const struct fw_rule *fr, struc
pr->proto = fr->fw_proto;
pr->af = AF_INET;
- pr->src.addr.v4.s_addr = fr->fw_src.addr_ip;
- addr_btom(fr->fw_src.addr_bits, &pr->src.mask.v4.s_addr, IP_ADDR_LEN);
+ PFRA_ADDR(&pr->src) = fr->fw_src.addr_ip;
+ addr_btom(fr->fw_src.addr_bits, &(PFRA_MASK(&pr->src)), IP_ADDR_LEN);
- pr->dst.addr.v4.s_addr = fr->fw_dst.addr_ip;
- addr_btom(fr->fw_dst.addr_bits, &pr->dst.mask.v4.s_addr, IP_ADDR_LEN);
+ PFRA_ADDR(&pr->dst) = fr->fw_dst.addr_ip;
+ addr_btom(fr->fw_dst.addr_bits, &(PFRA_MASK(&pr->dst)), IP_ADDR_LEN);
switch (fr->fw_proto) {
case IP_PROTO_ICMP:
@@ -102,12 +122,12 @@ pr_to_fr(const struct pf_rule *pr, struc
return (-1);
fr->fw_src.addr_type = ADDR_TYPE_IP;
- addr_mtob(&pr->src.mask.v4.s_addr, IP_ADDR_LEN, &fr->fw_src.addr_bits);
- fr->fw_src.addr_ip = pr->src.addr.v4.s_addr;
+ addr_mtob(&(PFRA_MASK(&pr->src)), IP_ADDR_LEN, &fr->fw_src.addr_bits);
+ fr->fw_src.addr_ip = PFRA_ADDR(&pr->src);
fr->fw_dst.addr_type = ADDR_TYPE_IP;
- addr_mtob(&pr->dst.mask.v4.s_addr, IP_ADDR_LEN, &fr->fw_dst.addr_bits);
- fr->fw_dst.addr_ip = pr->dst.addr.v4.s_addr;
+ addr_mtob(&(PFRA_MASK(&pr->dst)), IP_ADDR_LEN, &fr->fw_dst.addr_bits);
+ fr->fw_dst.addr_ip = PFRA_ADDR(&pr->dst);
switch (fr->fw_proto) {
case IP_PROTO_ICMP:
@@ -155,9 +175,8 @@ fw_add(fw_t *fw, const struct fw_rule *r
struct pfioc_changerule pcr;
assert(fw != NULL && rule != NULL);
-
+ memset(&pcr, 0, sizeof(pcr));
fr_to_pr(rule, &pcr.newrule);
-
pcr.action = PF_CHANGE_ADD_TAIL;
return (ioctl(fw->fd, DIOCCHANGERULE, &pcr));
@@ -169,9 +188,8 @@ fw_delete(fw_t *fw, const struct fw_rule
struct pfioc_changerule pcr;
assert(fw != NULL && rule != NULL);
-
+ memset(&pcr, 0, sizeof(pcr));
fr_to_pr(rule, &pcr.oldrule);
-
pcr.action = PF_CHANGE_REMOVE;
return (ioctl(fw->fd, DIOCCHANGERULE, &pcr));
@@ -183,24 +201,23 @@ fw_loop(fw_t *fw, fw_handler callback, v
struct pfioc_rule pr;
struct fw_rule fr;
uint32_t n, max;
- int ret;
-
+ int ret = 0;
+
+ memset(&pr, 0, sizeof(pr));
if (ioctl(fw->fd, DIOCGETRULES, &pr) < 0)
return (-1);
for (n = 0, max = pr.nr; n < max; n++) {
pr.nr = n;
- if (ioctl(fw->fd, DIOCGETRULE, &pr) < 0)
- return (-1);
-
+ if ((ret = ioctl(fw->fd, DIOCGETRULE, &pr)) < 0)
+ break;
if (pr_to_fr(&pr.rule, &fr) < 0)
continue;
-
if ((ret = callback(&fr, arg)) != 0)
- return (ret);
+ break;
}
- return (0);
+ return (ret);
}
fw_t *

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.2 2002/05/20 10:29:16 jsyn Exp $ @comment $OpenBSD: PLIST,v 1.3 2003/04/08 00:59:33 jsyn Exp $
bin/dnet-config bin/dnet-config
include/dnet.h include/dnet.h
include/dnet/addr.h include/dnet/addr.h
@ -9,6 +9,7 @@ include/dnet/fw.h
include/dnet/icmp.h include/dnet/icmp.h
include/dnet/intf.h include/dnet/intf.h
include/dnet/ip.h include/dnet/ip.h
include/dnet/ip6.h
include/dnet/os.h include/dnet/os.h
include/dnet/rand.h include/dnet/rand.h
include/dnet/route.h include/dnet/route.h