1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00

- Update to 1.3.1

- Add optional patches (to ipv4 port) to enable multiple fibs support, and to
  enable a simultaneous operation with other routing software
- Sign over a maintainership to an enthusiastic user

PR:		ports/157001
Submitted by:	Alexander V. Chernikov <melifaro@ipfw.ru>
This commit is contained in:
Pav Lucistnik 2011-06-02 19:52:40 +00:00
parent b13560374a
commit 7e5d5230b6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=274989
6 changed files with 159 additions and 9 deletions

View File

@ -6,24 +6,37 @@
#
PORTNAME= bird
PORTVERSION= 1.3.0
PORTVERSION= 1.3.1
CATEGORIES= net
MASTER_SITES= ftp://bird.network.cz/pub/bird/
MAINTAINER= pav@FreeBSD.org
MAINTAINER= melifaro@ipfw.ru
COMMENT= Dynamic IP routing daemon (IPv4 version)
USE_BISON= build
USE_GMAKE= yes
GNU_CONFIGURE= yes
OPTIONS= FIBS "Enable multiple fib support" Off \
LEARN_FIX "Support multiple routing daemons" Off
MAKE_JOBS_UNSAFE= yes
USE_RC_SUBR= bird
.include <bsd.port.pre.mk>
.if defined(WITH_FIBS)
EXTRA_PATCHES+= ${FILESDIR}/fibs.diff
.endif
.if defined(WITH_LEARN_FIX)
EXTRA_PATCHES+= ${FILESDIR}/learn-krt-sock.c
.endif
post-install:
@if [ ! -f ${PREFIX}/etc/bird.conf ]; then \
${CP} -p ${PREFIX}/etc/bird.conf.example ${PREFIX}/etc/bird.conf ; \
fi
.include <bsd.port.mk>
.include <bsd.port.post.mk>

View File

@ -1,2 +1,2 @@
SHA256 (bird-1.3.0.tar.gz) = ff90e3ee115a83e2b03a57095132923f66e1fca874dcca7a908075b6c2dc84b3
SIZE (bird-1.3.0.tar.gz) = 735100
SHA256 (bird-1.3.1.tar.gz) = 848be209aba6a1a85ae0ed6192710f8bcc2f1257068191fe2959398cdec01afb
SIZE (bird-1.3.1.tar.gz) = 826422

126
net/bird/files/fibs.diff Normal file
View File

@ -0,0 +1,126 @@
diff -urN sysdep/bsd/Modules sysdep/bsd/Modules
--- sysdep/bsd/Modules 2011-03-31 12:29:42.000000000 +0400
+++ sysdep/bsd/Modules 2011-05-10 12:04:30.643950460 +0400
@@ -4,3 +4,4 @@
krt-set.h
krt-sock.c
krt-sock.h
+fib.Y
diff -urN sysdep/bsd/fib.Y sysdep/bsd/fib.Y
--- sysdep/bsd/fib.Y 1970-01-01 03:00:00.000000000 +0300
+++ sysdep/bsd/fib.Y 2011-05-10 12:04:05.724272679 +0400
@@ -0,0 +1,29 @@
+/*
+ * BIRD -- FreeBSD rtsock configuration
+ *
+ * (c) 2011 Alexander V. Chernikov
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+CF_HDR
+
+CF_DECLS
+
+CF_KEYWORDS(ASYNC, KERNEL, TABLE, KRT_PREFSRC, KRT_REALM)
+
+CF_GRAMMAR
+
+CF_ADDTO(kern_proto, kern_proto rtsock_item ';')
+
+rtsock_item:
+ KERNEL TABLE expr {
+ if ($3 <= 0 || $3 >= max_fib_num())
+ cf_error("Kernel routing table number out of range");
+ THIS_KRT->scan.table_id = $3;
+ }
+ ;
+
+CF_CODE
+
+CF_END
diff -urN sysdep/bsd/krt-scan.h sysdep/bsd/krt-scan.h
--- sysdep/bsd/krt-scan.h 2011-03-31 12:29:42.000000000 +0400
+++ sysdep/bsd/krt-scan.h 2011-05-10 11:58:54.812942887 +0400
@@ -10,6 +10,7 @@
#define _BIRD_KRT_SCAN_H_
struct krt_scan_params {
+ int table_id; /* Kernel table ID we sync with */
};
struct krt_scan_status {
diff -urN sysdep/bsd/krt-sock.c sysdep/bsd/krt-sock.c
--- sysdep/bsd/krt-sock.c 2011-05-02 12:13:18.000000000 +0400
+++ sysdep/bsd/krt-sock.c 2011-05-10 12:25:22.075267568 +0400
@@ -53,6 +53,21 @@
);
}
+int
+max_fib_num()
+{
+ int fibs = 1;
+ size_t fibs_len = sizeof(fibs);
+ if (sysctlbyname("net.fibs", &fibs, &fibs_len, NULL, 0) == -1)
+ {
+ log(L_ERR "KRT: unable to get fib number, assuming 1. error: %s", strerror(errno));
+ return 1;
+ }
+
+ log(L_TRACE "Max fibs: %d\n", fibs);
+ return fibs;
+}
+
#define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
@@ -219,6 +234,7 @@
{
sock *sk_rt;
static int ks_open_tried = 0;
+ int fib = 0;
if (ks_open_tried)
return;
@@ -230,6 +246,16 @@
if( (rt_sock = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0)
die("Cannot open kernel socket for routes");
+ fib = ((struct krt_config *)x)->scan.table_id;
+ log(L_TRACE "KRT: Setting fib %d", fib);
+
+
+ if ((fib != 0) && (setsockopt(rt_sock, SOL_SOCKET, SO_SETFIB, &fib, sizeof(fib)) == -1))
+ {
+ log(L_ERR "KRT: setsockopt() failed for socket %d: %s", rt_sock, strerror(errno));
+ die("Cannot set fib for kernel socket");
+ }
+
sk_rt = sk_new(krt_pool);
sk_rt->type = SK_MAGIC;
sk_rt->rx_hook = krt_set_hook;
diff -urN sysdep/cf/bsd-v6.h sysdep/cf/bsd-v6.h
--- sysdep/cf/bsd-v6.h 2011-03-31 12:29:42.000000000 +0400
+++ sysdep/cf/bsd-v6.h 2011-05-10 11:19:01.394166479 +0400
@@ -10,7 +10,7 @@
#define CONFIG_AUTO_ROUTES
#define CONFIG_SELF_CONSCIOUS
-#undef CONFIG_MULTIPLE_TABLES
+#define CONFIG_MULTIPLE_TABLES
#undef CONFIG_UNIX_IFACE
#undef CONFIG_UNIX_SET
diff -urN sysdep/cf/bsd.h sysdep/cf/bsd.h
--- sysdep/cf/bsd.h 2011-03-31 12:29:42.000000000 +0400
+++ sysdep/cf/bsd.h 2011-05-10 11:19:01.398182352 +0400
@@ -8,7 +8,7 @@
#define CONFIG_AUTO_ROUTES
#define CONFIG_SELF_CONSCIOUS
-#undef CONFIG_MULTIPLE_TABLES
+#define CONFIG_MULTIPLE_TABLES
#undef CONFIG_UNIX_IFACE
#undef CONFIG_UNIX_SET

View File

@ -0,0 +1,11 @@
--- sysdep/bsd/krt-sock.c.orig 2011-05-11 10:41:35.432219356 +0400
+++ sysdep/bsd/krt-sock.c 2011-05-11 10:42:02.483875083 +0400
@@ -320,7 +320,7 @@
if ((flags & RTF_GATEWAY) && ipa_zero(igate))
{ log(L_ERR "%s (%I/%d) - missing gateway", errmsg, idst, pxlen); return; }
- u32 self_mask = RTF_PROTO1;
+ u32 self_mask = 0;
u32 alien_mask = RTF_STATIC | RTF_PROTO1 | RTF_GATEWAY;
#ifdef RTF_PROTO2

View File

@ -6,12 +6,12 @@
#
PORTNAME= bird6
PORTVERSION= 1.3.0
PORTVERSION= 1.3.1
CATEGORIES= net
MASTER_SITES= ftp://bird.network.cz/pub/bird/
DISTNAME= bird-${PORTVERSION}
MAINTAINER= pav@FreeBSD.org
MAINTAINER= melifaro@ipfw.ru
COMMENT= Dynamic IP routing daemon (IPv6 version)
USE_BISON= build

View File

@ -1,2 +1,2 @@
SHA256 (bird-1.3.0.tar.gz) = ff90e3ee115a83e2b03a57095132923f66e1fca874dcca7a908075b6c2dc84b3
SIZE (bird-1.3.0.tar.gz) = 735100
SHA256 (bird-1.3.1.tar.gz) = 848be209aba6a1a85ae0ed6192710f8bcc2f1257068191fe2959398cdec01afb
SIZE (bird-1.3.1.tar.gz) = 826422