Revision f4a60a9b proto/radv/radv.c

View differences:

proto/radv/radv.c
256 256
    radv_iface_notify(ifa, RA_EV_CHANGE);
257 257
}
258 258

  
259
static inline int radv_net_match_trigger(struct radv_config *cf, net *n)
259
static inline int
260
radv_trigger_valid(struct radv_config *cf)
260 261
{
261
  return cf->trigger_valid && net_equal(n->n.addr, cf->trigger);
262
  return cf->trigger.type != 0;
263
}
264

  
265
static inline int
266
radv_net_match_trigger(struct radv_config *cf, net *n)
267
{
268
  return radv_trigger_valid(cf) && net_equal(n->n.addr, &cf->trigger);
262 269
}
263 270

  
264 271
int
......
301 308
{
302 309
  struct radv_config *cf = (struct radv_config *) (ra->p.cf);
303 310

  
304
  if (! cf->trigger_valid)
311
  if (!radv_trigger_valid(cf))
305 312
    return 1;
306 313

  
307
  return rt_examine(ra->p.table, cf->trigger, &ra->p, ra->p.cf->out_filter);
314
  struct channel *c =ra->p.main_channel;
315
  return rt_examine(c->table, &cf->trigger, &ra->p, c->out_filter);
316
}
317

  
318
static void
319
radv_postconfig(struct proto_config *CF)
320
{
321
  // struct radv_config *cf = (void *) CF;
322

  
323
  /* Define default channel */
324
  if (EMPTY_LIST(CF->channels))
325
    channel_config_new(NULL, NET_IP6, CF);
308 326
}
309 327

  
310 328
static struct proto *
311
radv_init(struct proto_config *c)
329
radv_init(struct proto_config *CF)
312 330
{
313
  struct proto *p = proto_new(c, sizeof(struct proto_radv));
331
  struct proto *p = proto_new(CF);
332

  
333
  p->main_channel = proto_add_channel(p, proto_cf_main_channel(CF));
314 334

  
315
  p->accept_ra_types = RA_OPTIMAL;
316 335
  p->import_control = radv_import_control;
317 336
  p->rt_notify = radv_rt_notify;
318 337
  p->if_notify = radv_if_notify;
319 338
  p->ifa_notify = radv_ifa_notify;
339

  
320 340
  return p;
321 341
}
322 342

  
......
327 347
  struct radv_config *cf = (struct radv_config *) (p->cf);
328 348

  
329 349
  init_list(&(ra->iface_list));
330
  ra->active = !cf->trigger_valid;
350
  ra->active = !radv_trigger_valid(cf);
331 351

  
332 352
  return PS_UP;
333 353
}
......
352 372
}
353 373

  
354 374
static int
355
radv_reconfigure(struct proto *p, struct proto_config *c)
375
radv_reconfigure(struct proto *p, struct proto_config *CF)
356 376
{
357 377
  struct proto_radv *ra = (struct proto_radv *) p;
358 378
  // struct radv_config *old = (struct radv_config *) (p->cf);
359
  struct radv_config *new = (struct radv_config *) c;
379
  struct radv_config *new = (struct radv_config *) CF;
360 380

  
361 381
  /*
362 382
   * The question is why there is a reconfigure function for RAdv if
......
366 386
   * causing nodes to temporary remove their default routes.
367 387
   */
368 388

  
369
  p->cf = c; /* radv_check_active() requires proper p->cf */
389
  if (!proto_configure_channel(p, &p->main_channel, proto_cf_main_channel(CF)))
390
    return 0;
391

  
392
  p->cf = CF; /* radv_check_active() requires proper p->cf */
370 393
  ra->active = radv_check_active(ra);
371 394

  
372 395
  struct iface *iface;
......
423 446
struct protocol proto_radv = {
424 447
  .name =		"RAdv",
425 448
  .template =		"radv%d",
449
  .channel_mask =	NB_IP6,
450
  .proto_size =		sizeof(struct proto_radv),
426 451
  .config_size =	sizeof(struct radv_config),
452
  .postconfig =		radv_postconfig,
427 453
  .init =		radv_init,
428 454
  .start =		radv_start,
429 455
  .shutdown =		radv_shutdown,

Also available in: Unified diff