Revision 5e8df049 proto/babel/babel.c

View differences:

proto/babel/babel.c
53 53
static void babel_select_route(struct babel_entry *e);
54 54
static void babel_send_route_request(struct babel_entry *e, struct babel_neighbor *n);
55 55
static void babel_send_wildcard_request(struct babel_iface *ifa);
56
static int  babel_cache_seqno_request(struct babel_proto *p, ip_addr prefix, u8 plen,
57
			       u64 router_id, u16 seqno);
56
static int  babel_cache_seqno_request(struct babel_proto *p, net_addr *n, u64 router_id, u16 seqno);
58 57
static void babel_trigger_iface_update(struct babel_iface *ifa);
59 58
static void babel_trigger_update(struct babel_proto *p);
60 59
static void babel_send_seqno_request(struct babel_entry *e);
......
67 66
 */
68 67

  
69 68
static void
70
babel_init_entry(struct fib_node *n)
69
babel_init_entry(void *E)
71 70
{
72
  struct babel_entry *e = (void *) n;
73
  e->proto = NULL;
74
  e->selected_in = NULL;
75
  e->selected_out = NULL;
71
  struct babel_entry *e = E;
72

  
76 73
  e->updated = now;
77 74
  init_list(&e->sources);
78 75
  init_list(&e->routes);
79 76
}
80 77

  
81 78
static inline struct babel_entry *
82
babel_find_entry(struct babel_proto *p, ip_addr prefix, u8 plen)
79
babel_find_entry(struct babel_proto *p, const net_addr *n)
83 80
{
84
  return fib_find(&p->rtable, &prefix, plen);
81
  return fib_find(&p->rtable, n);
85 82
}
86 83

  
87 84
static struct babel_entry *
88
babel_get_entry(struct babel_proto *p, ip_addr prefix, u8 plen)
85
babel_get_entry(struct babel_proto *p, const net_addr *n)
89 86
{
90
  struct babel_entry *e = fib_get(&p->rtable, &prefix, plen);
87
  struct babel_entry *e = fib_get(&p->rtable, n);
91 88
  e->proto = p;
92 89
  return e;
93 90
}
......
180 177
{
181 178
  struct babel_proto *p = r->e->proto;
182 179

  
183
  DBG("Babel: Flush route %I/%d router_id %lR neigh %I\n",
184
      r->e->n.prefix, r->e->n.pxlen, r->router_id, r->neigh ? r->neigh->addr : IPA_NONE);
180
  DBG("Babel: Flush route %N router_id %lR neigh %I\n",
181
      r->e->n.addr, r->router_id, r->neigh ? r->neigh->addr : IPA_NONE);
185 182

  
186 183
  rem_node(NODE r);
187 184

  
......
203 200
  struct babel_proto *p = r->e->proto;
204 201
  struct babel_entry *e = r->e;
205 202

  
206
  TRACE(D_EVENTS, "Route expiry timer for %I/%d router-id %lR fired",
207
	e->n.prefix, e->n.pxlen, r->router_id);
203
  TRACE(D_EVENTS, "Route expiry timer for %N router-id %lR fired",
204
	e->n.addr, r->router_id);
208 205

  
209 206
  if (r->metric < BABEL_INFINITY)
210 207
  {
......
229 226
static void
230 227
babel_expire_routes(struct babel_proto *p)
231 228
{
232
  struct babel_entry *e;
233 229
  struct babel_route *r, *rx;
234 230
  struct fib_iterator fit;
235 231

  
236 232
  FIB_ITERATE_INIT(&fit, &p->rtable);
237 233

  
238 234
loop:
239
  FIB_ITERATE_START(&p->rtable, &fit, n)
235
  FIB_ITERATE_START(&p->rtable, &fit, struct babel_entry, e)
240 236
  {
241
    e = (struct babel_entry *) n;
242 237
    int changed = 0;
243 238

  
244 239
    WALK_LIST_DELSAFE(r, rx, e->routes)
......
261 256
       * babel_rt_notify() -> p->rtable change, invalidating hidden variables.
262 257
       */
263 258

  
264
      FIB_ITERATE_PUT(&fit, n);
259
      FIB_ITERATE_PUT(&fit);
265 260
      babel_select_route(e);
266 261
      goto loop;
267 262
    }
......
271 266
    /* Remove empty entries */
272 267
    if (EMPTY_LIST(e->sources) && EMPTY_LIST(e->routes))
273 268
    {
274
      FIB_ITERATE_PUT(&fit, n);
269
      FIB_ITERATE_PUT(&fit);
275 270
      fib_delete(&p->rtable, e);
276 271
      goto loop;
277 272
    }
278 273
  }
279
  FIB_ITERATE_END(n);
274
  FIB_ITERATE_END;
280 275
}
281 276

  
282 277
static struct babel_neighbor *
......
476 471

  
477 472
  if (r)
478 473
  {
479
    net *n = net_get(p->p.table, e->n.prefix, e->n.pxlen);
480
    rta A = {
474
    rta a0 = {
481 475
      .src = p->p.main_source,
482 476
      .source = RTS_BABEL,
483 477
      .scope = SCOPE_UNIVERSE,
......
489 483
    };
490 484

  
491 485
    if (r->metric < BABEL_INFINITY)
492
      A.gw = r->next_hop;
486
      a0.gw = r->next_hop;
493 487

  
494
    rta *a = rta_lookup(&A);
488
    rta *a = rta_lookup(&a0);
495 489
    rte *rte = rte_get_temp(a);
496 490
    rte->u.babel.metric = r->metric;
497 491
    rte->u.babel.router_id = r->router_id;
498
    rte->net = n;
499 492
    rte->pflags = 0;
500 493

  
501
    rte_update(&p->p, n, rte);
494
    rte_update(&p->p, e->n.addr, rte);
502 495
  }
503 496
  else
504 497
  {
505 498
    /* Retraction */
506
    net *n = net_find(p->p.table, e->n.prefix, e->n.pxlen);
507
    rte_update(&p->p, n, NULL);
499
    rte_update(&p->p, e->n.addr, NULL);
508 500
  }
509 501
}
510 502

  
......
541 533
      ((!e->selected_in && cur->metric < BABEL_INFINITY) ||
542 534
       (e->selected_in && cur->metric < e->selected_in->metric)))
543 535
  {
544
    TRACE(D_EVENTS, "Picked new route for prefix %I/%d: router id %lR metric %d",
545
	  e->n.prefix, e->n.pxlen, cur->router_id, cur->metric);
536
    TRACE(D_EVENTS, "Picked new route for prefix %N: router id %lR metric %d",
537
	  e->n.addr, cur->router_id, cur->metric);
546 538

  
547 539
    e->selected_in = cur;
548 540
    e->updated = now;
......
557 549
       babel_build_rte() will set the unreachable flag if the metric is BABEL_INFINITY.*/
558 550
    if (e->selected_in)
559 551
    {
560
      TRACE(D_EVENTS, "Lost feasible route for prefix %I/%d",
561
	    e->n.prefix, e->n.pxlen);
552
      TRACE(D_EVENTS, "Lost feasible route for prefix %N",
553
	    e->n.addr);
562 554

  
563 555
      e->selected_in->metric = BABEL_INFINITY;
564 556
      e->updated = now;
......
576 568
      /* No route currently selected, and no new one selected; this means we
577 569
	 don't have a route to this destination anymore (and were probably
578 570
	 called from an expiry timer). Remove the route from the nest. */
579
      TRACE(D_EVENTS, "Flushing route for prefix %I/%d", e->n.prefix, e->n.pxlen);
571
      TRACE(D_EVENTS, "Flushing route for prefix %N", e->n.addr);
580 572

  
581 573
      e->selected_in = NULL;
582 574
      e->updated = now;
......
663 655
  struct babel_iface *ifa = n->ifa;
664 656
  union babel_msg msg = {};
665 657

  
666
  TRACE(D_PACKETS, "Sending route request for %I/%d to %I",
667
        e->n.prefix, e->n.pxlen, n->addr);
658
  TRACE(D_PACKETS, "Sending route request for %N to %I",
659
        e->n.addr, n->addr);
668 660

  
669 661
  msg.type = BABEL_TLV_ROUTE_REQUEST;
670
  msg.route_request.prefix = e->n.prefix;
671
  msg.route_request.plen = e->n.pxlen;
662
  net_copy(&msg.route_request.net, e->n.addr);
672 663

  
673 664
  babel_send_unicast(&msg, ifa, n->addr);
674 665
}
......
698 689
  union babel_msg msg = {};
699 690

  
700 691
  s = babel_find_source(e, r->router_id);
701
  if (!s || !babel_cache_seqno_request(p, e->n.prefix, e->n.pxlen, r->router_id, s->seqno + 1))
692
  if (!s || !babel_cache_seqno_request(p, e->n.addr, r->router_id, s->seqno + 1))
702 693
    return;
703 694

  
704
  TRACE(D_PACKETS, "Sending seqno request for %I/%d router-id %lR seqno %d",
705
	e->n.prefix, e->n.pxlen, r->router_id, s->seqno + 1);
695
  TRACE(D_PACKETS, "Sending seqno request for %N router-id %lR seqno %d",
696
	e->n.addr, r->router_id, s->seqno + 1);
706 697

  
707 698
  msg.type = BABEL_TLV_SEQNO_REQUEST;
708
  msg.seqno_request.plen = e->n.pxlen;
709
  msg.seqno_request.seqno = s->seqno + 1;
710 699
  msg.seqno_request.hop_count = BABEL_INITIAL_HOP_COUNT;
700
  msg.seqno_request.seqno = s->seqno + 1;
711 701
  msg.seqno_request.router_id = r->router_id;
712
  msg.seqno_request.prefix = e->n.prefix;
702
  net_copy(&msg.seqno_request.net, e->n.addr);
713 703

  
714 704
  WALK_LIST(ifa, p->interfaces)
715 705
    babel_enqueue(&msg, ifa);
......
725 715
  union babel_msg msg = {};
726 716

  
727 717
  s = babel_find_source(e, r->router_id);
728
  if (!s || !babel_cache_seqno_request(p, e->n.prefix, e->n.pxlen, r->router_id, s->seqno + 1))
718
  if (!s || !babel_cache_seqno_request(p, e->n.addr, r->router_id, s->seqno + 1))
729 719
    return;
730 720

  
731
  TRACE(D_PACKETS, "Sending seqno request for %I/%d router-id %lR seqno %d",
732
	e->n.prefix, e->n.pxlen, r->router_id, s->seqno + 1);
721
  TRACE(D_PACKETS, "Sending seqno request for %N router-id %lR seqno %d",
722
	e->n.addr, r->router_id, s->seqno + 1);
733 723

  
734 724
  msg.type = BABEL_TLV_SEQNO_REQUEST;
735
  msg.seqno_request.plen = e->n.pxlen;
736
  msg.seqno_request.seqno = s->seqno + 1;
737 725
  msg.seqno_request.hop_count = BABEL_INITIAL_HOP_COUNT;
726
  msg.seqno_request.seqno = s->seqno + 1;
738 727
  msg.seqno_request.router_id = r->router_id;
739
  msg.seqno_request.prefix = e->n.prefix;
728
  net_copy(&msg.seqno_request.net, e->n.addr);
740 729

  
741 730
  babel_send_unicast(&msg, ifa, r->neigh->addr);
742 731
}
......
756 745
{
757 746
  struct babel_proto *p = ifa->proto;
758 747

  
759
  FIB_WALK(&p->rtable, n)
748
  FIB_WALK(&p->rtable, struct babel_entry, e)
760 749
  {
761
    struct babel_entry *e = (void *) n;
762 750
    struct babel_route *r = e->selected_out;
763 751

  
764 752
    if (!r)
......
776 764
    if (e->updated < changed)
777 765
      continue;
778 766

  
779
    TRACE(D_PACKETS, "Sending update for %I/%d router-id %lR seqno %d metric %d",
780
	  e->n.prefix, e->n.pxlen, r->router_id, r->seqno, r->metric);
767
    TRACE(D_PACKETS, "Sending update for %N router-id %lR seqno %d metric %d",
768
	  e->n.addr, r->router_id, r->seqno, r->metric);
781 769

  
782 770
    union babel_msg msg = {};
783 771
    msg.type = BABEL_TLV_UPDATE;
784
    msg.update.plen = e->n.pxlen;
785 772
    msg.update.interval = ifa->cf->update_interval;
786 773
    msg.update.seqno = r->seqno;
787 774
    msg.update.metric = r->metric;
788
    msg.update.prefix = e->n.prefix;
789 775
    msg.update.router_id = r->router_id;
776
    net_copy(&msg.update.net, e->n.addr);
790 777

  
791 778
    babel_enqueue(&msg, ifa);
792 779

  
......
839 826

  
840 827
/* A retraction is an update with an infinite metric */
841 828
static void
842
babel_send_retraction(struct babel_iface *ifa, ip_addr prefix, int plen)
829
babel_send_retraction(struct babel_iface *ifa, net_addr *n)
843 830
{
844 831
  struct babel_proto *p = ifa->proto;
845 832
  union babel_msg msg = {};
846 833

  
847
  TRACE(D_PACKETS, "Sending retraction for %I/%d seqno %d",
848
	prefix, plen, p->update_seqno);
834
  TRACE(D_PACKETS, "Sending retraction for %N seqno %d", n, p->update_seqno);
849 835

  
850 836
  msg.type = BABEL_TLV_UPDATE;
851
  msg.update.plen = plen;
852 837
  msg.update.interval = ifa->cf->update_interval;
853 838
  msg.update.seqno = p->update_seqno;
854 839
  msg.update.metric = BABEL_INFINITY;
855
  msg.update.prefix = prefix;
840
  msg.update.net = *n;
856 841

  
857 842
  babel_enqueue(&msg, ifa);
858 843
}
......
941 926
 * found. Otherwise, a new entry is stored in the cache.
942 927
 */
943 928
static int
944
babel_cache_seqno_request(struct babel_proto *p, ip_addr prefix, u8 plen,
929
babel_cache_seqno_request(struct babel_proto *p, net_addr *n,
945 930
                          u64 router_id, u16 seqno)
946 931
{
947 932
  struct babel_seqno_request *r;
948 933

  
949 934
  WALK_LIST(r, p->seqno_cache)
950 935
  {
951
    if (ipa_equal(r->prefix, prefix) && (r->plen == plen) &&
952
	(r->router_id == router_id) && (r->seqno == seqno))
936
    if (net_equal(&r->net, n) && (r->router_id == router_id) && (r->seqno == seqno))
953 937
      return 0;
954 938
  }
955 939

  
956 940
  /* no entries found */
957 941
  r = sl_alloc(p->seqno_slab);
958
  r->prefix = prefix;
959
  r->plen = plen;
942
  net_copy(&r->net, n);
960 943
  r->router_id = router_id;
961 944
  r->seqno = seqno;
962 945
  r->updated = now;
......
973 956
  struct babel_proto *p = e->proto;
974 957
  struct babel_route *r;
975 958

  
976
  TRACE(D_PACKETS, "Forwarding seqno request for %I/%d router-id %lR seqno %d",
977
	e->n.prefix, e->n.pxlen, in->router_id, in->seqno);
959
  TRACE(D_PACKETS, "Forwarding seqno request for %N router-id %lR seqno %d",
960
	e->n.addr, in->router_id, in->seqno);
978 961

  
979 962
  WALK_LIST(r, e->routes)
980 963
  {
......
982 965
	!OUR_ROUTE(r) &&
983 966
	!ipa_equal(r->neigh->addr, sender))
984 967
    {
985
      if (!babel_cache_seqno_request(p, e->n.prefix, e->n.pxlen, in->router_id, in->seqno))
968
      if (!babel_cache_seqno_request(p, e->n.addr, in->router_id, in->seqno))
986 969
	return;
987 970

  
988 971
      union babel_msg msg = {};
989 972
      msg.type = BABEL_TLV_SEQNO_REQUEST;
990
      msg.seqno_request.plen = in->plen;
991
      msg.seqno_request.seqno = in->seqno;
992 973
      msg.seqno_request.hop_count = in->hop_count-1;
974
      msg.seqno_request.seqno = in->seqno;
993 975
      msg.seqno_request.router_id = in->router_id;
994
      msg.seqno_request.prefix = e->n.prefix;
976
      net_copy(&msg.seqno_request.net, e->n.addr);
995 977

  
996 978
      babel_send_unicast(&msg, r->neigh->ifa, r->neigh->addr);
997 979
      return;
......
1073 1055
  node *n;
1074 1056
  int feasible;
1075 1057

  
1076
  TRACE(D_PACKETS, "Handling update for %I/%d with seqno %d metric %d",
1077
	msg->prefix, msg->plen, msg->seqno, msg->metric);
1058
  if (msg->wildcard)
1059
    TRACE(D_PACKETS, "Handling wildcard retraction", msg->seqno);
1060
  else
1061
    TRACE(D_PACKETS, "Handling update for %N with seqno %d metric %d",
1062
	  &msg->net, msg->seqno, msg->metric);
1078 1063

  
1079 1064
  nbr = babel_find_neighbor(ifa, msg->sender);
1080 1065
  if (!nbr)
......
1140 1125
    }
1141 1126
    else
1142 1127
    {
1143
      e = babel_find_entry(p, msg->prefix, msg->plen);
1128
      e = babel_find_entry(p, &msg->net);
1144 1129

  
1145 1130
      if (!e)
1146 1131
	return;
......
1159 1144
    return;
1160 1145
  }
1161 1146

  
1162
  e = babel_get_entry(p, msg->prefix, msg->plen);
1147
  e = babel_get_entry(p, &msg->net);
1163 1148
  r = babel_find_route(e, nbr); /* the route entry indexed by neighbour */
1164 1149
  s = babel_find_source(e, msg->router_id); /* for feasibility */
1165 1150
  feasible = babel_is_feasible(s, msg->seqno, msg->metric);
......
1231 1216
    return;
1232 1217
  }
1233 1218

  
1234
  TRACE(D_PACKETS, "Handling route request for %I/%d", msg->prefix, msg->plen);
1219
  TRACE(D_PACKETS, "Handling route request for %N", &msg->net);
1235 1220

  
1236 1221
  /* Non-wildcard request - see if we have an entry for the route.
1237 1222
     If not, send a retraction, otherwise send an update. */
1238
  struct babel_entry *e = babel_find_entry(p, msg->prefix, msg->plen);
1223
  struct babel_entry *e = babel_find_entry(p, &msg->net);
1239 1224
  if (!e)
1240 1225
  {
1241
    babel_send_retraction(ifa, msg->prefix, msg->plen);
1226
    babel_send_retraction(ifa, &msg->net);
1242 1227
  }
1243 1228
  else
1244 1229
  {
......
1256 1241

  
1257 1242
  /* RFC 6126 3.8.1.2 */
1258 1243

  
1259
  TRACE(D_PACKETS, "Handling seqno request for %I/%d router-id %lR seqno %d hop count %d",
1260
	msg->prefix, msg->plen, msg->router_id, msg->seqno, msg->hop_count);
1244
  TRACE(D_PACKETS, "Handling seqno request for %N router-id %lR seqno %d hop count %d",
1245
	&msg->net, msg->router_id, msg->seqno, msg->hop_count);
1261 1246

  
1262 1247
  /* Ignore if we have no such entry or entry has infinite metric */
1263
  struct babel_entry *e = babel_find_entry(p, msg->prefix, msg->plen);
1248
  struct babel_entry *e = babel_find_entry(p, &msg->net);
1264 1249
  if (!e || !e->selected_out || (e->selected_out->metric == BABEL_INFINITY))
1265 1250
    return;
1266 1251

  
......
1668 1653
  struct babel_source *s;
1669 1654
  struct babel_route *r;
1670 1655

  
1671
  debug("Babel: Entry %I/%d:\n", e->n.prefix, e->n.pxlen);
1656
  debug("Babel: Entry %N:\n", e->n.addr);
1672 1657

  
1673 1658
  WALK_LIST(s,e->sources)
1674 1659
  { debug(" "); babel_dump_source(s); }
......
1715 1700
  WALK_LIST(ifa, p->interfaces)
1716 1701
    babel_dump_iface(ifa);
1717 1702

  
1718
  FIB_WALK(&p->rtable, n)
1703
  FIB_WALK(&p->rtable, struct babel_entry, e)
1719 1704
  {
1720
    babel_dump_entry((struct babel_entry *) n);
1705
    babel_dump_entry(e);
1721 1706
  }
1722 1707
  FIB_WALK_END;
1723 1708
}
......
1828 1813
babel_show_entries(struct proto *P)
1829 1814
{
1830 1815
  struct babel_proto *p = (void *) P;
1831
  struct babel_entry *e = NULL;
1832 1816
  struct babel_source *s = NULL;
1833 1817
  struct babel_route *r = NULL;
1834 1818

  
1835
  char ipbuf[STD_ADDRESS_P_LENGTH+5];
1836 1819
  char ridbuf[ROUTER_ID_64_LENGTH+1];
1837 1820

  
1838 1821
  if (p->p.proto_state != PS_UP)
......
1846 1829
  cli_msg(-1025, "%-29s %-23s %6s %5s %7s %7s",
1847 1830
	  "Prefix", "Router ID", "Metric", "Seqno", "Expires", "Sources");
1848 1831

  
1849
  FIB_WALK(&p->rtable, n)
1832
  FIB_WALK(&p->rtable, struct babel_entry, e)
1850 1833
  {
1851
    e = (struct babel_entry *) n;
1852 1834
    r = e->selected_in ? e->selected_in : e->selected_out;
1853 1835

  
1854 1836
    int srcs = 0;
1855 1837
    WALK_LIST(s, e->sources)
1856 1838
      srcs++;
1857 1839

  
1858
    bsprintf(ipbuf, "%I/%u", e->n.prefix, e->n.pxlen);
1859

  
1860 1840
    if (r)
1861 1841
    {
1862 1842
      if (r->router_id == p->router_id)
......
1865 1845
        bsprintf(ridbuf, "%lR", r->router_id);
1866 1846

  
1867 1847
      int time = r->expires ? r->expires - now : 0;
1868
      cli_msg(-1025, "%-29s %-23s %6u %5u %7u %7u",
1869
	      ipbuf, ridbuf, r->metric, r->seqno, MAX(time, 0), srcs);
1848
      cli_msg(-1025, "%-29N %-23s %6u %5u %7u %7u",
1849
	      e->n.addr, ridbuf, r->metric, r->seqno, MAX(time, 0), srcs);
1870 1850
    }
1871 1851
    else
1872 1852
    {
1873
      cli_msg(-1025, "%-29s %-44s %7u", ipbuf, "<pending>", srcs);
1853
      cli_msg(-1025, "%-29N %-44s %7u", e->n.addr, "<pending>", srcs);
1874 1854
    }
1875 1855
  }
1876 1856
  FIB_WALK_END;
......
1964 1944
 * so store it into our data structures.
1965 1945
 */
1966 1946
static void
1967
babel_rt_notify(struct proto *P, struct rtable *table UNUSED, struct network *net,
1947
babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net,
1968 1948
		struct rte *new, struct rte *old UNUSED, struct ea_list *attrs UNUSED)
1969 1949
{
1970 1950
  struct babel_proto *p = (void *) P;
......
1974 1954
  if (new)
1975 1955
  {
1976 1956
    /* Update */
1977
    e = babel_get_entry(p, net->n.prefix, net->n.pxlen);
1957
    e = babel_get_entry(p, net->n.addr);
1978 1958

  
1979 1959
    if (new->attrs->src->proto != P)
1980 1960
    {
......
1996 1976
  else
1997 1977
  {
1998 1978
    /* Withdraw */
1999
    e = babel_find_entry(p, net->n.prefix, net->n.pxlen);
1979
    e = babel_find_entry(p, net->n.addr);
2000 1980
    if (!e || !e->selected_out)
2001 1981
      return;
2002 1982

  
......
2046 2026

  
2047 2027

  
2048 2028
static struct proto *
2049
babel_init(struct proto_config *cfg)
2029
babel_init(struct proto_config *CF)
2050 2030
{
2051
  struct proto *P = proto_new(cfg, sizeof(struct babel_proto));
2031
  struct proto *P = proto_new(CF);
2032

  
2033
  P->main_channel = proto_add_channel(P, proto_cf_main_channel(CF));
2052 2034

  
2053
  P->accept_ra_types = RA_OPTIMAL;
2054 2035
  P->if_notify = babel_if_notify;
2055 2036
  P->rt_notify = babel_rt_notify;
2056 2037
  P->import_control = babel_import_control;
......
2068 2049
  struct babel_proto *p = (void *) P;
2069 2050
  struct babel_config *cf = (void *) P->cf;
2070 2051

  
2071
  fib_init(&p->rtable, P->pool, sizeof(struct babel_entry), 0, babel_init_entry);
2052
  fib_init(&p->rtable, P->pool, NET_IP6, sizeof(struct babel_entry),
2053
	   OFFSETOF(struct babel_entry, n), 0, babel_init_entry);
2072 2054
  init_list(&p->interfaces);
2073 2055
  p->timer = tm_new_set(P->pool, babel_timer, p, 0, 1);
2074 2056
  tm_start(p->timer, 2);
......
2111 2093
}
2112 2094

  
2113 2095
static int
2114
babel_reconfigure(struct proto *P, struct proto_config *c)
2096
babel_reconfigure(struct proto *P, struct proto_config *CF)
2115 2097
{
2116 2098
  struct babel_proto *p = (void *) P;
2117
  struct babel_config *new = (void *) c;
2099
  struct babel_config *new = (void *) CF;
2118 2100

  
2119 2101
  TRACE(D_EVENTS, "Reconfiguring");
2120 2102

  
2121
  p->p.cf = c;
2103
  if (!proto_configure_channel(P, &P->main_channel, proto_cf_main_channel(CF)))
2104
    return 0;
2105

  
2106
  p->p.cf = CF;
2122 2107
  babel_reconfigure_ifaces(p, new);
2123 2108

  
2124 2109
  babel_trigger_update(p);
......
2133 2118
  .template =		"babel%d",
2134 2119
  .attr_class =		EAP_BABEL,
2135 2120
  .preference =		DEF_PREF_BABEL,
2121
  .channel_mask =	NB_IP6,
2122
  .proto_size =		sizeof(struct babel_proto),
2136 2123
  .config_size =	sizeof(struct babel_config),
2137 2124
  .init =		babel_init,
2138 2125
  .dump =		babel_dump,

Also available in: Unified diff