View | Details | Raw Unified | Return to bug 157001
Collapse All | Expand All

(-)net/bird.new/Makefile (-2 / +15 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	bird
8
PORTNAME=	bird
9
PORTVERSION=	1.3.0
9
PORTVERSION=	1.3.1
10
CATEGORIES=	net
10
CATEGORIES=	net
11
MASTER_SITES=	ftp://bird.network.cz/pub/bird/
11
MASTER_SITES=	ftp://bird.network.cz/pub/bird/
12
12
Lines 17-29 Link Here
17
USE_GMAKE=	yes
17
USE_GMAKE=	yes
18
GNU_CONFIGURE=	yes
18
GNU_CONFIGURE=	yes
19
19
20
OPTIONS=	FIBS		"Enable multiple fib support" Off \
21
		LEARN_FIX	"Support multiple routing daemons" Off
22
20
MAKE_JOBS_UNSAFE=	yes
23
MAKE_JOBS_UNSAFE=	yes
21
24
22
USE_RC_SUBR=	bird
25
USE_RC_SUBR=	bird
23
26
27
.include <bsd.port.pre.mk>
28
29
.if defined(WITH_FIBS)
30
EXTRA_PATCHES+=	${FILESDIR}/fibs.diff
31
.endif
32
33
.if defined(WITH_LEARN_FIX)
34
EXTRA_PATCHES+=	${FILESDIR}/learn-krt-sock.c
35
.endif
36
24
post-install:
37
post-install:
25
	@if [ ! -f ${PREFIX}/etc/bird.conf ]; then \
38
	@if [ ! -f ${PREFIX}/etc/bird.conf ]; then \
26
		${CP} -p ${PREFIX}/etc/bird.conf.example ${PREFIX}/etc/bird.conf ; \
39
		${CP} -p ${PREFIX}/etc/bird.conf.example ${PREFIX}/etc/bird.conf ; \
27
	fi
40
	fi
28
41
29
.include <bsd.port.mk>
42
.include <bsd.port.post.mk>
(-)net/bird.new/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (bird-1.3.0.tar.gz) = ff90e3ee115a83e2b03a57095132923f66e1fca874dcca7a908075b6c2dc84b3
1
SHA256 (bird-1.3.1.tar.gz) = 848be209aba6a1a85ae0ed6192710f8bcc2f1257068191fe2959398cdec01afb
2
SIZE (bird-1.3.0.tar.gz) = 735100
2
SIZE (bird-1.3.1.tar.gz) = 826422
(-)net/bird.new/files/fibs.diff (+126 lines)
Line 0 Link Here
1
diff -urN sysdep/bsd/Modules sysdep/bsd/Modules
2
--- sysdep/bsd/Modules	2011-03-31 12:29:42.000000000 +0400
3
+++ sysdep/bsd/Modules	2011-05-10 12:04:30.643950460 +0400
4
@@ -4,3 +4,4 @@
5
 krt-set.h
6
 krt-sock.c
7
 krt-sock.h
8
+fib.Y
9
diff -urN sysdep/bsd/fib.Y sysdep/bsd/fib.Y
10
--- sysdep/bsd/fib.Y	1970-01-01 03:00:00.000000000 +0300
11
+++ sysdep/bsd/fib.Y	2011-05-10 12:04:05.724272679 +0400
12
@@ -0,0 +1,29 @@
13
+/*
14
+ *	BIRD -- FreeBSD rtsock configuration
15
+ *
16
+ *	(c) 2011 Alexander V. Chernikov
17
+ *
18
+ *	Can be freely distributed and used under the terms of the GNU GPL.
19
+ */
20
+
21
+CF_HDR
22
+
23
+CF_DECLS
24
+
25
+CF_KEYWORDS(ASYNC, KERNEL, TABLE, KRT_PREFSRC, KRT_REALM)
26
+
27
+CF_GRAMMAR
28
+
29
+CF_ADDTO(kern_proto, kern_proto rtsock_item ';')
30
+
31
+rtsock_item:
32
+   KERNEL TABLE expr {
33
+	if ($3 <= 0 || $3 >= max_fib_num())
34
+	  cf_error("Kernel routing table number out of range");
35
+	THIS_KRT->scan.table_id = $3;
36
+   }
37
+ ;
38
+
39
+CF_CODE
40
+
41
+CF_END
42
diff -urN sysdep/bsd/krt-scan.h sysdep/bsd/krt-scan.h
43
--- sysdep/bsd/krt-scan.h	2011-03-31 12:29:42.000000000 +0400
44
+++ sysdep/bsd/krt-scan.h	2011-05-10 11:58:54.812942887 +0400
45
@@ -10,6 +10,7 @@
46
 #define _BIRD_KRT_SCAN_H_
47
 
48
 struct krt_scan_params {
49
+  int table_id;				/* Kernel table ID we sync with */
50
 };
51
 
52
 struct krt_scan_status {
53
diff -urN sysdep/bsd/krt-sock.c sysdep/bsd/krt-sock.c
54
--- sysdep/bsd/krt-sock.c	2011-05-02 12:13:18.000000000 +0400
55
+++ sysdep/bsd/krt-sock.c	2011-05-10 12:25:22.075267568 +0400
56
@@ -53,6 +53,21 @@
57
      );
58
 }
59
 
60
+int
61
+max_fib_num()
62
+{
63
+  int fibs = 1;
64
+  size_t fibs_len = sizeof(fibs);
65
+  if (sysctlbyname("net.fibs", &fibs, &fibs_len, NULL, 0) == -1)
66
+  {
67
+    log(L_ERR "KRT: unable to get fib number, assuming 1. error: %s", strerror(errno));
68
+    return 1;
69
+  }
70
+
71
+  log(L_TRACE "Max fibs: %d\n", fibs);
72
+  return fibs;
73
+}
74
+
75
 #define ROUNDUP(a) \
76
         ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
77
 
78
@@ -219,6 +234,7 @@
79
 {
80
   sock *sk_rt;
81
   static int ks_open_tried = 0;
82
+  int fib = 0;
83
 
84
   if (ks_open_tried)
85
     return;
86
@@ -230,6 +246,16 @@
87
   if( (rt_sock = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0)
88
     die("Cannot open kernel socket for routes");
89
 
90
+  fib = ((struct krt_config *)x)->scan.table_id;
91
+  log(L_TRACE "KRT: Setting fib %d", fib);
92
+
93
+
94
+  if ((fib != 0) && (setsockopt(rt_sock, SOL_SOCKET, SO_SETFIB, &fib, sizeof(fib)) == -1))
95
+  {
96
+    log(L_ERR "KRT: setsockopt() failed for socket %d: %s", rt_sock, strerror(errno));
97
+    die("Cannot set fib for kernel socket");
98
+  }
99
+
100
   sk_rt = sk_new(krt_pool);
101
   sk_rt->type = SK_MAGIC;
102
   sk_rt->rx_hook = krt_set_hook;
103
diff -urN sysdep/cf/bsd-v6.h sysdep/cf/bsd-v6.h
104
--- sysdep/cf/bsd-v6.h	2011-03-31 12:29:42.000000000 +0400
105
+++ sysdep/cf/bsd-v6.h	2011-05-10 11:19:01.394166479 +0400
106
@@ -10,7 +10,7 @@
107
 
108
 #define CONFIG_AUTO_ROUTES
109
 #define CONFIG_SELF_CONSCIOUS
110
-#undef CONFIG_MULTIPLE_TABLES
111
+#define CONFIG_MULTIPLE_TABLES
112
 
113
 #undef CONFIG_UNIX_IFACE
114
 #undef CONFIG_UNIX_SET
115
diff -urN sysdep/cf/bsd.h sysdep/cf/bsd.h
116
--- sysdep/cf/bsd.h	2011-03-31 12:29:42.000000000 +0400
117
+++ sysdep/cf/bsd.h	2011-05-10 11:19:01.398182352 +0400
118
@@ -8,7 +8,7 @@
119
 
120
 #define CONFIG_AUTO_ROUTES
121
 #define CONFIG_SELF_CONSCIOUS
122
-#undef CONFIG_MULTIPLE_TABLES
123
+#define CONFIG_MULTIPLE_TABLES
124
 
125
 #undef CONFIG_UNIX_IFACE
126
 #undef CONFIG_UNIX_SET
(-)net/bird.new/files/learn-krt-sock.c (+11 lines)
Line 0 Link Here
1
--- sysdep/bsd/krt-sock.c.orig	2011-05-11 10:41:35.432219356 +0400
2
+++ sysdep/bsd/krt-sock.c	2011-05-11 10:42:02.483875083 +0400
3
@@ -320,7 +320,7 @@
4
   if ((flags & RTF_GATEWAY) && ipa_zero(igate))
5
     { log(L_ERR "%s (%I/%d) - missing gateway", errmsg, idst, pxlen); return; }
6
 
7
-  u32 self_mask = RTF_PROTO1;
8
+  u32 self_mask = 0;
9
   u32 alien_mask = RTF_STATIC | RTF_PROTO1 | RTF_GATEWAY;
10
 
11
 #ifdef RTF_PROTO2

Return to bug 157001