]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Split protocol init to building of protocol list and real protocol init.
authorMartin Mares <mj@ucw.cz>
Sun, 18 Oct 1998 11:53:21 +0000 (11:53 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 18 Oct 1998 11:53:21 +0000 (11:53 +0000)
Added kernel route table syncer skeleton.

nest/proto.c
nest/protocol.h
nest/route.h
sysdep/unix/Modules
sysdep/unix/main.c
sysdep/unix/sync-if.c
sysdep/unix/sync-rt.c [new file with mode: 0644]
sysdep/unix/unix.h

index 6db5a0ef84a15ac01c063b5e26493f45c5727a23..6c0843d888ae86b068e552f4742f23132e2d7c9a 100644 (file)
@@ -106,15 +106,20 @@ protos_dump_all(void)
     debug("  inactive %s\n", p->name);
 }
 
+void
+protos_build(void)
+{
+  init_list(&protocol_list);
+  add_tail(&protocol_list, &proto_device.n);
+  add_tail(&protocol_list, &proto_rip.n);
+}
+
 void
 protos_init(void)
 {
   struct protocol *p;
 
   debug("Initializing protocols\n");
-  init_list(&protocol_list);
-  add_tail(&protocol_list, &proto_device.n);
-  add_tail(&protocol_list, &proto_rip.n); /* HACK: We should really read this from config */
   WALK_LIST(p, protocol_list)
     p->init(p);
 }
index 6059f7c26e1bbe72b165e99a5dc023e335a87193..9a0ea98dd96da4f00b92928ff2d9d4d4bebb6378 100644 (file)
@@ -32,6 +32,7 @@ struct protocol {
   void (*postconfig)(struct protocol *); /* After configuring */
 };
 
+void protos_build(void);
 void protos_init(void);
 void protos_preconfig(void);
 void protos_postconfig(void);
index e50de07d380c20a542a7474b47b9718921d6c4cb..78f9446a677756ffde6e94f4d84e6214751cd28c 100644 (file)
@@ -248,6 +248,7 @@ void rta_dump_all(void);
 #define DEF_PREF_BGP           100     /* BGP */
 #define DEF_PREF_OSPF_EXTERNAL 80      /* OSPF external routes */
 #define DEF_PREF_RIP_EXTERNAL  70      /* RIP external routes */
+#define DEF_PREF_UKR           50      /* Unidentified Kernel Route */
 #define DEF_PREF_SINK          10      /* Sink route */
 
 #endif
index 0b5117a50ace8a098c7c5bc17b0133cc6f770fb1..f3e68e820e103bdf051fe9ae2fc852bab60eb069 100644 (file)
@@ -4,3 +4,4 @@ timer.h
 io.c
 unix.h
 sync-if.c
+sync-rt.c
index b57e94e5b80e356c2993655ccb9b2395f411b4ce..a6c47487696d289d739cff45e79a75be5b566c84 100644 (file)
@@ -76,6 +76,8 @@ main(void)
   io_init();
   rt_init();
   if_init();
+  protos_build();
+  add_tail(&protocol_list, &proto_unix_kernel.n); /* FIXME: Must be _always_ the last one */
   protos_init();
   protos_preconfig();
   protos_postconfig();
index 4478c10474240dece78a3ec9fcbfc5935097d6b4..44392560419fb6daff60c18b44ab2b97a4e7292c 100644 (file)
@@ -180,4 +180,3 @@ scan_if_init(void)
   if_scan_timer->recurrent = if_scan_period;
   tm_start(if_scan_timer, if_scan_period);
 }
-
diff --git a/sysdep/unix/sync-rt.c b/sysdep/unix/sync-rt.c
new file mode 100644 (file)
index 0000000..c1bf7f7
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ *     BIRD -- Unix Routing Table Scanning and Syncing
+ *
+ *     (c) 1998 Martin Mares <mj@ucw.cz>
+ *
+ *     Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+#define LOCAL_DEBUG
+
+#include "nest/bird.h"
+#include "nest/iface.h"
+#include "nest/route.h"
+#include "nest/protocol.h"
+#include "lib/timer.h"
+
+#include "unix.h"
+
+void
+uk_rt_notify(struct proto *p, net *net, rte *new, rte *old)
+{
+}
+
+void
+uk_start(struct proto *p)
+{
+}
+
+void
+uk_init(struct protocol *x)
+{
+}
+
+void
+uk_preconfig(struct protocol *x)
+{
+  struct proto *p = proto_new(&proto_unix_kernel, sizeof(struct proto));
+
+  p->preference = DEF_PREF_UKR;
+  p->rt_notify = uk_rt_notify;
+  p->start = uk_start;
+}
+
+void
+uk_postconfig(struct protocol *x)
+{
+}
+
+struct protocol proto_unix_kernel = {
+  { NULL, NULL },
+  "kernel",
+  0,
+  uk_init,
+  uk_preconfig,
+  uk_postconfig
+};
index 127101e7c1a3ad8603c9d5ce09bc7cdb878b86a7..7b0a921e5bf1519727fdde57fd5dcf9c8456d7a1 100644 (file)
@@ -22,4 +22,8 @@ extern int if_scan_period;
 
 void scan_if_init(void);
 
+/* sync-rt.c */
+
+extern struct protocol proto_unix_kernel;
+
 #endif