Commits

David Lamparter authored and Denis Ovsienko committed ebf08631cad
zebra: fix redistribution of new protocols

redistribute is currently limited to "known" protocols. there is no reason for this limitation, so, remove it.
No tags

zebra/redistribute.c

Modified
238 238 }
239 239 }
240 240
241 241 void
242 242 zebra_redistribute_add (int command, struct zserv *client, int length)
243 243 {
244 244 int type;
245 245
246 246 type = stream_getc (client->ibuf);
247 247
248 - switch (type)
248 + if (type == 0 || type >= ZEBRA_ROUTE_MAX)
249 + return;
250 +
251 + if (! client->redist[type])
249 252 {
250 - case ZEBRA_ROUTE_KERNEL:
251 - case ZEBRA_ROUTE_CONNECT:
252 - case ZEBRA_ROUTE_STATIC:
253 - case ZEBRA_ROUTE_RIP:
254 - case ZEBRA_ROUTE_RIPNG:
255 - case ZEBRA_ROUTE_OSPF:
256 - case ZEBRA_ROUTE_OSPF6:
257 - case ZEBRA_ROUTE_BGP:
258 - if (! client->redist[type])
259 - {
260 - client->redist[type] = 1;
261 - zebra_redistribute (client, type);
262 - }
263 - break;
264 - default:
265 - break;
253 + client->redist[type] = 1;
254 + zebra_redistribute (client, type);
266 255 }
267 -}
256 +}
268 257
269 258 void
270 259 zebra_redistribute_delete (int command, struct zserv *client, int length)
271 260 {
272 261 int type;
273 262
274 263 type = stream_getc (client->ibuf);
275 264
276 - switch (type)
277 - {
278 - case ZEBRA_ROUTE_KERNEL:
279 - case ZEBRA_ROUTE_CONNECT:
280 - case ZEBRA_ROUTE_STATIC:
281 - case ZEBRA_ROUTE_RIP:
282 - case ZEBRA_ROUTE_RIPNG:
283 - case ZEBRA_ROUTE_OSPF:
284 - case ZEBRA_ROUTE_OSPF6:
285 - case ZEBRA_ROUTE_BGP:
286 - client->redist[type] = 0;
287 - break;
288 - default:
289 - break;
290 - }
291 -}
265 + if (type == 0 || type >= ZEBRA_ROUTE_MAX)
266 + return;
267 +
268 + client->redist[type] = 0;
269 +}
292 270
293 271 void
294 272 zebra_redistribute_default_add (int command, struct zserv *client, int length)
295 273 {
296 274 client->redist_default = 1;
297 275 zebra_redistribute_default (client);
298 276 }
299 277
300 278 void
301 279 zebra_redistribute_default_delete (int command, struct zserv *client,

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut