1 --- a/lib/quagga/src/common.h
2 +++ b/lib/quagga/src/common.h
6 * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
7 - * Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
8 + * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
14 /* Zebra route types */
15 #define ZEBRA_ROUTE_OLSR 11
16 -#define ZEBRA_ROUTE_MAX 13
17 +#define ZEBRA_ROUTE_MAX 14
21 --- a/lib/quagga/src/packet.c
22 +++ b/lib/quagga/src/packet.c
26 * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
27 - * Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
28 + * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
30 * This program is free software; you can redistribute it and/or modify
31 * it under the terms of the GNU General Public License version 2 as
32 @@ -28,24 +28,43 @@ unsigned char
37 + uint16_t size, safi;
39 unsigned char *cmdopt, *t;
41 cmdopt = olsr_malloc(ZEBRA_MAX_PACKET_SIZ, "QUAGGA: New route packet");
44 - if (zebra.version) {
45 - *t++ = ZEBRA_HEADER_MARKER;
46 - *t++ = zebra.version;
48 - memcpy(t, &cmd, sizeof cmd);
51 + switch (zebra.version) {
53 *t++ = (unsigned char) cmd;
57 + *t++ = ZEBRA_HEADER_MARKER;
58 + *t++ = zebra.version;
60 + memcpy(t, &cmd, sizeof cmd);
69 + switch (zebra.version) {
74 + safi = htons(r->safi);
75 + memcpy(t, &safi, sizeof safi);
82 len = (r->prefixlen + 7) / 8;
83 if (olsr_cnf->ip_version == AF_INET)
84 @@ -97,14 +116,21 @@ unsigned char
85 data = olsr_malloc(ZEBRA_MAX_PACKET_SIZ , "QUAGGA: New redistribute packet");
88 - if (zebra.version) {
89 - *pnt++ = ZEBRA_HEADER_MARKER;
90 - *pnt++ = zebra.version;
92 - memcpy(pnt, &cmd, sizeof cmd);
95 + switch (zebra.version) {
97 *pnt++ = (unsigned char) cmd;
101 + *pnt++ = ZEBRA_HEADER_MARKER;
102 + *pnt++ = zebra.version;
104 + memcpy(pnt, &cmd, sizeof cmd);
111 size = htons(pnt - data);
112 memcpy(data, &size, sizeof size);
113 --- a/lib/quagga/src/packet.h
114 +++ b/lib/quagga/src/packet.h
116 * OLSRd Quagga plugin
118 * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
119 - * Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
120 + * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
122 * This program is free software; you can redistribute it and/or modify
123 * it under the terms of the GNU General Public License version 2 as
125 #define ZEBRA_IPV6_ROUTE_DELETE 10
126 #define ZEBRA_REDISTRIBUTE_ADD 11
127 #define ZEBRA_REDISTRIBUTE_DELETE 12
128 +#define ZEBRA_HELLO 23
130 /* Zebra nexthop flags */
131 #define ZEBRA_NEXTHOP_IFINDEX 1
133 #define ZAPI_MESSAGE_DISTANCE 0x04
134 #define ZAPI_MESSAGE_METRIC 0x08
136 +/* Subsequent Address Family Identifier */
137 +#define SAFI_UNICAST 1
140 #define ZEBRA_FLAG_SELECTED 0x10
142 @@ -51,6 +55,7 @@ struct zroute {
145 unsigned char message;
147 unsigned char prefixlen;
148 union olsr_ip_addr prefix;
149 unsigned char nexthop_num;
150 --- a/lib/quagga/src/parse.c
151 +++ b/lib/quagga/src/parse.c
153 * OLSRd Quagga plugin
155 * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
156 - * Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
157 + * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
159 * This program is free software; you can redistribute it and/or modify
160 * it under the terms of the GNU General Public License version 2 as
161 @@ -52,7 +52,17 @@ static struct zroute
162 length = ntohs (length);
164 r = olsr_malloc(sizeof *r, "QUAGGA: New zebra route");
165 - pnt = (zebra.version ? &opt[6] : &opt[3]);
166 + switch (zebra.version) {
180 @@ -68,6 +78,7 @@ static struct zroute
181 switch (zebra.version) {
185 if (r->message & ZAPI_MESSAGE_NEXTHOP) {
186 r->nexthop_num = *pnt++;
187 r->nexthop = olsr_malloc((sizeof *r->nexthop) * r->nexthop_num, "QUAGGA: New zebra route nexthop");
188 @@ -137,13 +148,20 @@ zparse(void *foo __attribute__ ((unused)
189 length = ntohs (length);
190 if (!length) // something weired happened
191 olsr_exit("(QUAGGA) Zero message length!", EXIT_FAILURE);
192 - if (zebra.version) {
193 - if ((f[2] != ZEBRA_HEADER_MARKER) || (f[3] != zebra.version))
194 - olsr_exit("(QUAGGA) Invalid zebra header received!", EXIT_FAILURE);
195 - memcpy(&command, &f[4], sizeof command);
196 - command = ntohs (command);
198 + switch (zebra.version) {
204 + if ((f[2] != ZEBRA_HEADER_MARKER) || (f[3] != zebra.version))
205 + olsr_exit("(QUAGGA) Invalid zebra header received!", EXIT_FAILURE);
206 + memcpy(&command, &f[4], sizeof command);
207 + command = ntohs (command);
212 if (olsr_cnf->ip_version == AF_INET) {
214 case ZEBRA_IPV4_ROUTE_ADD:
215 --- a/lib/quagga/src/plugin.c
216 +++ b/lib/quagga/src/plugin.c
218 * OLSRd Quagga plugin
220 * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
221 - * Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
222 + * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
224 * This program is free software; you can redistribute it and/or modify
225 * it under the terms of the GNU General Public License version 2 as
226 @@ -50,7 +50,7 @@ zplugin_redistribute(const char *value,
228 const char *zroute_types[] = { "system", "kernel", "connect",
229 "static", "rip", "ripng", "ospf", "ospf6", "isis", "bgp",
230 - "hsls", "olsr", "batman"
231 + "hsls", "olsr", "batman", "babel"
235 @@ -144,7 +144,7 @@ zplugin_version(const char *value, void
237 if (set_plugin_int(value, &version, addon))
239 - if (version < 0 || version > 1)
240 + if (version < 0 || version > 2)
242 zebra.version = version;
244 --- a/lib/quagga/src/quagga.c
245 +++ b/lib/quagga/src/quagga.c
247 * OLSRd Quagga plugin
249 * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
250 - * Copyright (C) 2007-2011 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
251 + * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
253 * This program is free software; you can redistribute it and/or modify
254 * it under the terms of the GNU General Public License version 2 as
255 @@ -63,6 +63,7 @@ zebra_addroute(const struct rt_entry *r)
256 route.type = ZEBRA_ROUTE_OLSR;
257 route.flags = zebra.flags;
258 route.message = ZAPI_MESSAGE_NEXTHOP | ZAPI_MESSAGE_METRIC;
259 + route.safi = SAFI_UNICAST;
260 route.prefixlen = r->rt_dst.prefix_len;
261 if (olsr_cnf->ip_version == AF_INET)
262 route.prefix.v4.s_addr = r->rt_dst.prefix.v4.s_addr;
263 @@ -112,6 +113,7 @@ zebra_delroute(const struct rt_entry *r)
264 route.type = ZEBRA_ROUTE_OLSR;
265 route.flags = zebra.flags;
266 route.message = ZAPI_MESSAGE_NEXTHOP | ZAPI_MESSAGE_METRIC;
267 + route.safi = SAFI_UNICAST;
268 route.prefixlen = r->rt_dst.prefix_len;
269 if (olsr_cnf->ip_version == AF_INET)
270 route.prefix.v4.s_addr = r->rt_dst.prefix.v4.s_addr;
271 @@ -164,6 +166,15 @@ zebra_redistribute(uint16_t cmd)
276 +zebra_hello(uint16_t cmd)
279 + if (zclient_write(zpacket_redistribute(cmd, ZEBRA_ROUTE_OLSR)) < 0)
280 + olsr_exit("(QUAGGA) Could not write hello packet!", EXIT_FAILURE);
287 --- a/lib/quagga/src/client.c
288 +++ b/lib/quagga/src/client.c
290 * OLSRd Quagga plugin
292 * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
293 - * Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
294 + * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
296 * This program is free software; you can redistribute it and/or modify
297 * it under the terms of the GNU General Public License version 2 as
298 @@ -95,6 +95,7 @@ zclient_reconnect(void)
299 if (!(zebra.status & STATUS_CONNECTED))
300 return; // try again next time
302 + zebra_hello(ZEBRA_HELLO);
303 if (zebra.options & OPTION_EXPORT) {
304 OLSR_FOR_ALL_RT_ENTRIES(tmp) {
306 --- a/lib/quagga/README_QUAGGA
307 +++ b/lib/quagga/README_QUAGGA
308 @@ -11,9 +11,9 @@ It allows olsrd to redistribute from var
309 as well as to export olsr-routes to quagga so that they can be
310 redistributed by the quagga-routing-daemons.
312 -You also need a source distribution of quagga-0.98.6 or quagga-0.99.15.
313 +You also need a source distribution of quagga-0.98.6 or quagga-0.99.21.
314 The quagga source tree needs to be patched with quagga-0.98.6.diff or
315 -quagga-0.99.15.diff, respectively, compiled and installed via
316 +quagga-0.99.21.diff, respectively, compiled and installed via
319 ---------------------------------------------------------------------
320 @@ -48,7 +48,10 @@ PlParam "Port" "<port>"
322 PlParam "Version" "<version>"
323 sets the version of packet format to communicate with zebra.
324 - use "0" for Quagga 0.98.x and "1" for Quagga 0.99.x.
326 + "0" for Quagga 0.98.x
327 + "1" for Quagga 0.99.17 up to 0.99.20.1
328 + "2" for Quagga 0.99.21 and above
331 ---------------------------------------------------------------------
332 @@ -65,9 +68,9 @@ LoadPlugin "olsrd_quagga.so.0.2.2"
333 PlParam "Distance" "125"
334 PlParam "LocalPref" "false"
335 PlParam "SockPath" "/var/run/zserv.api"
336 - PlParam "Version" "1"
337 + PlParam "Version" "2"
341 ---------------------------------------------------------------------
344 --- a/lib/quagga/src/quagga.h
345 +++ b/lib/quagga/src/quagga.h
347 * OLSRd Quagga plugin
349 * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
350 - * Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
351 + * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
353 * This program is free software; you can redistribute it and/or modify
354 * it under the terms of the GNU General Public License version 2 as
355 @@ -31,6 +31,7 @@ void zebra_fini(void);
356 int zebra_addroute(const struct rt_entry *);
357 int zebra_delroute(const struct rt_entry *);
358 void zebra_redistribute(uint16_t cmd);
359 +void zebra_hello(uint16_t cmd);