ospf.c 38.5 KB
Newer Older
1 2 3
/*
 *	BIRD -- OSPF
 *
Ondřej Filip's avatar
Ondřej Filip committed
4
 *	(c) 1999--2004 Ondrej Filip <feela@network.cz>
5 6
 *	(c) 2009--2014 Ondrej Zajicek <santiago@crfreenet.org>
 *	(c) 2009--2014 CZ.NIC z.s.p.o.
7 8 9 10
 *
 *	Can be freely distributed and used under the terms of the GNU GPL.
 */

Ondřej Filip's avatar
Ondřej Filip committed
11 12
/**
 * DOC: Open Shortest Path First (OSPF)
13
 *
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
 * The OSPF protocol is quite complicated and its complex implemenation is split
 * to many files. In |ospf.c|, you will find mainly the interface for
 * communication with the core (e.g., reconfiguration hooks, shutdown and
 * initialisation and so on). File |iface.c| contains the interface state
 * machine and functions for allocation and deallocation of OSPF's interface
 * data structures. Source |neighbor.c| includes the neighbor state machine and
 * functions for election of Designated Router and Backup Designated router. In
 * |packet.c|, you will find various functions for sending and receiving generic
 * OSPF packets. There are also routines for authentication and checksumming.
 * In |hello.c|, there are routines for sending and receiving of hello packets
 * as well as functions for maintaining wait times and the inactivity timer.
 * Files |lsreq.c|, |lsack.c|, |dbdes.c| contain functions for sending and
 * receiving of link-state requests, link-state acknowledgements and database
 * descriptions respectively.  In |lsupd.c|, there are functions for sending and
 * receiving of link-state updates and also the flooding algorithm. Source
 * |topology.c| is a place where routines for searching LSAs in the link-state
 * database, adding and deleting them reside, there also are functions for
 * originating of various types of LSAs (router LSA, net LSA, external LSA).
 * File |rt.c| contains routines for calculating the routing table. |lsalib.c|
 * is a set of various functions for working with the LSAs (endianity
 * conversions, calculation of checksum etc.).
Ondřej Filip's avatar
Ondřej Filip committed
35
 *
36 37 38 39 40 41 42
 * One instance of the protocol is able to hold LSA databases for multiple OSPF
 * areas, to exchange routing information between multiple neighbors and to
 * calculate the routing tables. The core structure is &ospf_proto to which
 * multiple &ospf_area and &ospf_iface structures are connected. &ospf_proto is
 * also connected to &top_hash_graph which is a dynamic hashing structure that
 * describes the link-state database. It allows fast search, addition and
 * deletion. Each LSA is kept in two pieces: header and body. Both of them are
43
 * kept in the endianity of the CPU.
44
 *
45 46 47 48 49 50 51
 * In OSPFv2 specification, it is implied that there is one IP prefix for each
 * physical network/interface (unless it is an ptp link). But in modern systems,
 * there might be more independent IP prefixes associated with an interface.  To
 * handle this situation, we have one &ospf_iface for each active IP prefix
 * (instead for each active iface); This behaves like virtual interface for the
 * purpose of OSPF.  If we receive packet, we associate it with a proper virtual
 * interface mainly according to its source address.
Ondřej Zajíček's avatar
Ondřej Zajíček committed
52
 *
53 54 55 56 57 58 59 60
 * OSPF keeps one socket per &ospf_iface. This allows us (compared to one socket
 * approach) to evade problems with a limit of multicast groups per socket and
 * with sending multicast packets to appropriate interface in a portable way.
 * The socket is associated with underlying physical iface and should not
 * receive packets received on other ifaces (unfortunately, this is not true on
 * BSD). Generally, one packet can be received by more sockets (for example, if
 * there are more &ospf_iface on one physical iface), therefore we explicitly
 * filter received packets according to src/dst IP address and received iface.
Ondřej Zajíček's avatar
Ondřej Zajíček committed
61
 *
62 63 64 65
 * Vlinks are implemented using particularly degenerate form of &ospf_iface,
 * which has several exceptions: it does not have its iface or socket (it copies
 * these from 'parent' &ospf_iface) and it is present in iface list even when
 * down (it is not freed in ospf_iface_down()).
Ondřej Zajíček's avatar
Ondřej Zajíček committed
66
 *
67
 * The heart beat of ospf is ospf_disp(). It is called at regular intervals
68 69 70
 * (&ospf_proto->tick). It is responsible for aging and flushing of LSAs in the
 * database, updating topology information in LSAs and for routing table
 * calculation.
71
 *
72 73 74
 * To every &ospf_iface, we connect one or more &ospf_neighbor's -- a structure
 * containing many timers and queues for building adjacency and for exchange of
 * routing messages.
Ondřej Filip's avatar
Ondřej Filip committed
75
 *
76 77 78 79 80 81 82
 * BIRD's OSPF implementation respects RFC2328 in every detail, but some of
 * internal algorithms do differ. The RFC recommends making a snapshot of the
 * link-state database when a new adjacency is forming and sending the database
 * description packets based on the information in this snapshot. The database
 * can be quite large in some networks, so rather we walk through a &slist
 * structure which allows us to continue even if the actual LSA we were working
 * with is deleted. New LSAs are added at the tail of this &slist.
Ondřej Filip's avatar
Ondřej Filip committed
83
 *
84 85 86 87 88
 * We also do not keep a separate OSPF routing table, because the core helps us
 * by being able to recognize when a route is updated to an identical one and it
 * suppresses the update automatically. Due to this, we can flush all the routes
 * we have recalculated and also those we have deleted to the core's routing
 * table and the core will take care of the rest. This simplifies the process
89
 * and conserves memory.
90 91 92 93 94
 *
 * Supported standards:
 * - RFC 2328 - main OSPFv2 standard
 * - RFC 5340 - main OSPFv3 standard
 * - RFC 3101 - OSPFv2 NSSA areas
95 96 97 98
 * - RFC 5709 - OSPFv2 HMAC-SHA Cryptographic Authentication
 * - RFC 5838 - OSPFv3 Support of Address Families
 * - RFC 6549 - OSPFv2 Multi-Instance Extensions
 * - RFC 6987 - OSPF Stub Router Advertisement
Ondřej Filip's avatar
Ondřej Filip committed
99 100
 */

101
#include <stdlib.h>
102 103
#include "ospf.h"

104 105 106
static int ospf_import_control(struct proto *P, rte **new, ea_list **attrs, struct linpool *pool);
static struct ea_list *ospf_make_tmp_attrs(struct rte *rt, struct linpool *pool);
static void ospf_store_tmp_attrs(struct rte *rt, struct ea_list *attrs);
107
static void ospf_reload_routes(struct channel *C);
108 109
static int ospf_rte_better(struct rte *new, struct rte *old);
static int ospf_rte_same(struct rte *new, struct rte *old);
110 111
static void ospf_disp(timer *timer);

Ondřej Filip's avatar
Ondřej Filip committed
112 113 114 115

static void
add_area_nets(struct ospf_area *oa, struct ospf_area_config *ac)
{
116 117 118
  struct ospf_proto *p = oa->po;
  struct area_net_config *anc;
  struct area_net *an;
Ondřej Filip's avatar
Ondřej Filip committed
119

120
  fib_init(&oa->net_fib,  p->p.pool, ospf_get_af(p),
121
	   sizeof(struct area_net), OFFSETOF(struct area_net, fn), 0, NULL);
122
  fib_init(&oa->enet_fib, p->p.pool, ospf_get_af(p),
123
	   sizeof(struct area_net), OFFSETOF(struct area_net, fn), 0, NULL);
Ondřej Filip's avatar
Ondřej Filip committed
124

125 126
  WALK_LIST(anc, ac->net_list)
  {
127
    an = fib_get(&oa->net_fib, &anc->prefix);
128 129
    an->hidden = anc->hidden;
  }
130

131 132
  WALK_LIST(anc, ac->enet_list)
  {
133
    an = fib_get(&oa->enet_fib, &anc->prefix);
134 135 136
    an->hidden = anc->hidden;
    an->tag = anc->tag;
  }
Ondřej Filip's avatar
Ondřej Filip committed
137
}
138

139 140 141 142 143 144 145 146 147 148
static inline uint
ospf_opts(struct ospf_proto *p)
{
  if (ospf_is_v2(p))
    return 0;

  return ((ospf_is_ip6(p) && !p->af_mc) ? OPT_V6 : 0) |
    (!p->stub_router ? OPT_R : 0) | (p->af_ext ? OPT_AF : 0);
}

149
static void
150
ospf_area_add(struct ospf_proto *p, struct ospf_area_config *ac)
151 152 153 154 155
{
  struct ospf_area *oa;

  OSPF_TRACE(D_EVENTS, "Adding area %R", ac->areaid);

156 157 158
  oa = mb_allocz(p->p.pool, sizeof(struct ospf_area));
  add_tail(&p->area_list, NODE oa);
  p->areano++;
159 160 161 162

  oa->ac = ac;
  oa->areaid = ac->areaid;
  oa->rt = NULL;
163
  oa->po = p;
164
  fib_init(&oa->rtr, p->p.pool, NET_IP4, sizeof(ort), OFFSETOF(ort, fn), 0, NULL);
165 166 167
  add_area_nets(oa, ac);

  if (oa->areaid == 0)
168
    p->backbone = oa;
169

170
  oa->options = ac->type | ospf_opts(p);
171 172

  ospf_notify_rt_lsa(oa);
173
}
174

175 176 177 178
static void
ospf_flush_area(struct ospf_proto *p, u32 areaid)
{
  struct top_hash_entry *en;
179

180 181 182
  WALK_SLIST(en, p->lsal)
    if ((LSA_SCOPE(en->lsa_type) == LSA_SCOPE_AREA) && (en->domain == areaid))
      ospf_flush_lsa(p, en);
183 184 185 186 187
}

static void
ospf_area_remove(struct ospf_area *oa)
{
188
  struct ospf_proto *p = oa->po;
189 190 191
  OSPF_TRACE(D_EVENTS, "Removing area %R", oa->areaid);

  /* We suppose that interfaces are already removed */
192
  ospf_flush_area(p, oa->areaid);
193

194 195
  fib_free(&oa->rtr);
  fib_free(&oa->net_fib);
196
  fib_free(&oa->enet_fib);
197

198 199 200
  if (oa->translator_timer)
    rfree(oa->translator_timer);

201
  p->areano--;
202 203 204 205 206 207
  rem_node(NODE oa);
  mb_free(oa);
}


struct ospf_area *
208
ospf_find_area(struct ospf_proto *p, u32 aid)
209 210
{
  struct ospf_area *oa;
211
  WALK_LIST(oa, p->area_list)
212 213 214 215 216 217
    if (((struct ospf_area *) oa)->areaid == aid)
      return oa;
  return NULL;
}

static struct ospf_iface *
218
ospf_find_vlink(struct ospf_proto *p, u32 voa, u32 vid)
219 220
{
  struct ospf_iface *ifa;
221
  WALK_LIST(ifa, p->iface_list)
222 223 224 225 226
    if ((ifa->type == OSPF_IT_VLINK) && (ifa->voa->areaid == voa) && (ifa->vid == vid))
      return ifa;
  return NULL;
}

227
static int
228
ospf_start(struct proto *P)
229
{
230 231
  struct ospf_proto *p = (struct ospf_proto *) P;
  struct ospf_config *c = (struct ospf_config *) (P->cf);
232
  struct ospf_area_config *ac;
Ondřej Filip's avatar
Ondřej Filip committed
233

234 235
  p->router_id = proto_get_router_id(P->cf);
  p->ospf2 = c->ospf2;
236 237
  p->af_ext = c->af_ext;
  p->af_mc = c->af_mc;
238 239 240 241 242 243
  p->rfc1583 = c->rfc1583;
  p->stub_router = c->stub_router;
  p->merge_external = c->merge_external;
  p->asbr = c->asbr;
  p->ecmp = c->ecmp;
  p->tick = c->tick;
244 245
  p->disp_timer = tm_new_init(P->pool, ospf_disp, p, p->tick S, 0);
  tm_start(p->disp_timer, 100 MS);
246 247 248
  p->lsab_size = 256;
  p->lsab_used = 0;
  p->lsab = mb_alloc(P->pool, p->lsab_size);
249
  p->nhpool = lp_new(P->pool, 12*sizeof(struct nexthop));
250 251
  init_list(&(p->iface_list));
  init_list(&(p->area_list));
252
  fib_init(&p->rtf, P->pool, ospf_get_af(p), sizeof(ort), OFFSETOF(ort, fn), 0, NULL);
253 254
  if (ospf_is_v3(p))
    idm_init(&p->idm, P->pool, 16);
255
  p->areano = 0;
256
  p->gr = ospf_top_new(p, P->pool);
257
  s_init_list(&(p->lsal));
258

259 260 261 262
  p->flood_event = ev_new(P->pool);
  p->flood_event->hook = ospf_flood_event;
  p->flood_event->data = p;

263 264 265
  p->log_pkt_tbf = (struct tbf){ .rate = 1, .burst = 5 };
  p->log_lsa_tbf = (struct tbf){ .rate = 4, .burst = 20 };

Ondřej Filip's avatar
Ondřej Filip committed
266
  WALK_LIST(ac, c->area_list)
267
    ospf_area_add(p, ac);
268

269
  if (c->abr)
270
    ospf_open_vlink_sk(p);
271

272 273 274
  /* Add all virtual links */
  struct ospf_iface_patt *ic;
  WALK_LIST(ic, c->vlink_list)
275
    ospf_iface_new_vlink(p, ic);
276

277 278 279 280
  return PS_UP;
}

static void
281
ospf_dump(struct proto *P)
282
{
283
  struct ospf_proto *p = (struct ospf_proto *) P;
Ondřej Filip's avatar
Ondřej Filip committed
284 285
  struct ospf_iface *ifa;
  struct ospf_neighbor *n;
286

287
  OSPF_TRACE(D_EVENTS, "Area number: %d", p->areano);
Ondřej Filip's avatar
Ondřej Filip committed
288

289
  WALK_LIST(ifa, p->iface_list)
Ondřej Filip's avatar
Ondřej Filip committed
290
  {
291
    OSPF_TRACE(D_EVENTS, "Interface: %s", ifa->ifname);
Ondřej Filip's avatar
Ondřej Filip committed
292
    OSPF_TRACE(D_EVENTS, "state: %u", ifa->state);
293 294
    OSPF_TRACE(D_EVENTS, "DR:  %R", ifa->drid);
    OSPF_TRACE(D_EVENTS, "BDR: %R", ifa->bdrid);
Ondřej Filip's avatar
Ondřej Filip committed
295 296
    WALK_LIST(n, ifa->neigh_list)
    {
297
      OSPF_TRACE(D_EVENTS, "  neighbor %R in state %u", n->rid, n->state);
Ondřej Filip's avatar
Ondřej Filip committed
298 299
    }
  }
300

301
  /*
302
  OSPF_TRACE(D_EVENTS, "LSA graph dump start:");
303
  ospf_top_dump(p->gr, p);
304
  OSPF_TRACE(D_EVENTS, "LSA graph dump finished");
305
  */
306
  neigh_dump_all();
307 308 309
}

static struct proto *
310
ospf_init(struct proto_config *CF)
311
{
312 313 314 315
  struct ospf_config *cf = (struct ospf_config *) CF;
  struct proto *P = proto_new(CF);

  P->main_channel = proto_add_channel(P, proto_cf_main_channel(CF));
316 317 318

  P->rt_notify = ospf_rt_notify;
  P->if_notify = ospf_if_notify;
319
  P->ifa_notify = cf->ospf2 ? ospf_ifa_notify2 : ospf_ifa_notify3;
320 321 322 323 324 325 326 327
  P->import_control = ospf_import_control;
  P->reload_routes = ospf_reload_routes;
  P->make_tmp_attrs = ospf_make_tmp_attrs;
  P->store_tmp_attrs = ospf_store_tmp_attrs;
  P->rte_better = ospf_rte_better;
  P->rte_same = ospf_rte_same;

  return P;
328 329
}

Ondřej Filip's avatar
Ondřej Filip committed
330 331 332 333
/* If new is better return 1 */
static int
ospf_rte_better(struct rte *new, struct rte *old)
{
Ondřej Filip's avatar
Ondřej Filip committed
334 335
  if (new->u.ospf.metric1 == LSINFINITY)
    return 0;
Ondřej Filip's avatar
Ondřej Filip committed
336

Ondřej Filip's avatar
Ondřej Filip committed
337 338
  if(new->attrs->source < old->attrs->source) return 1;
  if(new->attrs->source > old->attrs->source) return 0;
Ondřej Filip's avatar
Ondřej Filip committed
339

Ondřej Filip's avatar
Ondřej Filip committed
340
  if(new->attrs->source == RTS_OSPF_EXT2)
Ondřej Filip's avatar
Ondřej Filip committed
341
  {
Ondřej Filip's avatar
Ondřej Filip committed
342 343
    if(new->u.ospf.metric2 < old->u.ospf.metric2) return 1;
    if(new->u.ospf.metric2 > old->u.ospf.metric2) return 0;
Ondřej Filip's avatar
Ondřej Filip committed
344
  }
Ondřej Filip's avatar
Ondřej Filip committed
345

Ondřej Filip's avatar
Ondřej Filip committed
346 347
  if (new->u.ospf.metric1 < old->u.ospf.metric1)
    return 1;
Ondřej Filip's avatar
Ondřej Filip committed
348

Ondřej Filip's avatar
Ondřej Filip committed
349
  return 0;			/* Old is shorter or same */
Ondřej Filip's avatar
Ondřej Filip committed
350 351
}

Ondřej Filip's avatar
Ondřej Filip committed
352 353 354
static int
ospf_rte_same(struct rte *new, struct rte *old)
{
355 356 357 358
  /* new->attrs == old->attrs always */
  return
    new->u.ospf.metric1 == old->u.ospf.metric1 &&
    new->u.ospf.metric2 == old->u.ospf.metric2 &&
359 360
    new->u.ospf.tag == old->u.ospf.tag &&
    new->u.ospf.router_id == old->u.ospf.router_id;
361
}
Ondřej Filip's avatar
Ondřej Filip committed
362

363
static ea_list *
Ondřej Filip's avatar
Ondřej Filip committed
364
ospf_build_attrs(ea_list * next, struct linpool *pool, u32 m1, u32 m2,
365
		 u32 tag, u32 rid)
366
{
Ondřej Filip's avatar
Ondřej Filip committed
367
  struct ea_list *l =
368
    lp_alloc(pool, sizeof(struct ea_list) + 4 * sizeof(eattr));
369 370 371

  l->next = next;
  l->flags = EALF_SORTED;
372
  l->count = 4;
373 374 375 376 377 378 379 380 381 382 383 384
  l->attrs[0].id = EA_OSPF_METRIC1;
  l->attrs[0].flags = 0;
  l->attrs[0].type = EAF_TYPE_INT | EAF_TEMP;
  l->attrs[0].u.data = m1;
  l->attrs[1].id = EA_OSPF_METRIC2;
  l->attrs[1].flags = 0;
  l->attrs[1].type = EAF_TYPE_INT | EAF_TEMP;
  l->attrs[1].u.data = m2;
  l->attrs[2].id = EA_OSPF_TAG;
  l->attrs[2].flags = 0;
  l->attrs[2].type = EAF_TYPE_INT | EAF_TEMP;
  l->attrs[2].u.data = tag;
385 386
  l->attrs[3].id = EA_OSPF_ROUTER_ID;
  l->attrs[3].flags = 0;
387
  l->attrs[3].type = EAF_TYPE_ROUTER_ID | EAF_TEMP;
388
  l->attrs[3].u.data = rid;
389
  return l;
Ondřej Filip's avatar
Ondřej Filip committed
390 391
}

392 393

void
394
ospf_schedule_rtcalc(struct ospf_proto *p)
395
{
396
  if (p->calcrt)
Ondřej Filip's avatar
Ondřej Filip committed
397
    return;
398

399
  OSPF_TRACE(D_EVENTS, "Scheduling routing table calculation");
400
  p->calcrt = 1;
401 402
}

403 404
static void
ospf_reload_routes(struct channel *C)
405
{
406
  struct ospf_proto *p = (struct ospf_proto *) C->proto;
407

408 409
  if (p->calcrt == 2)
    return;
410

411
  OSPF_TRACE(D_EVENTS, "Scheduling routing table calculation with route reload");
412
  p->calcrt = 2;
413 414
}

415

416
/**
417
 * ospf_disp - invokes routing table calculation, aging and also area_disp()
418 419
 * @timer: timer usually called every @ospf_proto->tick second, @timer->data
 * point to @ospf_proto
420
 */
421
static void
422 423
ospf_disp(timer * timer)
{
424
  struct ospf_proto *p = timer->data;
425

426 427
  /* Originate or flush local topology LSAs */
  ospf_update_topology(p);
428

429
  /* Process LSA DB */
430
  ospf_update_lsadb(p);
431

432
  /* Calculate routing table */
433 434
  if (p->calcrt)
    ospf_rt_spf(p);
435 436
}

437

Ondřej Filip's avatar
Ondřej Filip committed
438 439
/**
 * ospf_import_control - accept or reject new route from nest's routing table
440
 * @P: OSPF protocol instance
Martin Mareš's avatar
Martin Mareš committed
441
 * @new: the new route
442 443
 * @attrs: list of attributes
 * @pool: pool for allocation of attributes
Ondřej Filip's avatar
Ondřej Filip committed
444
 *
445 446
 * Its quite simple. It does not accept our own routes and leaves the decision on
 * import to the filters.
Ondřej Filip's avatar
Ondřej Filip committed
447
 */
448
static int
449
ospf_import_control(struct proto *P, rte **new, ea_list **attrs UNUSED, struct linpool *pool UNUSED)
450
{
451 452
  struct ospf_proto *p = (struct ospf_proto *) P;
  struct ospf_area *oa = ospf_main_area(p);
Ondřej Filip's avatar
Ondřej Filip committed
453
  rte *e = *new;
454

455
  /* Reject our own routes */
456
  if (e->attrs->src->proto == P)
457
    return -1;
458

459
  /* Do not export routes to stub areas */
460
  if (oa_is_stub(oa))
461
    return -1;
462

463
  return 0;
464
}
465

466
static struct ea_list *
467 468
ospf_make_tmp_attrs(struct rte *rt, struct linpool *pool)
{
Ondřej Filip's avatar
Ondřej Filip committed
469
  return ospf_build_attrs(NULL, pool, rt->u.ospf.metric1, rt->u.ospf.metric2,
470
			  rt->u.ospf.tag, rt->u.ospf.router_id);
471 472
}

473
static void
474 475
ospf_store_tmp_attrs(struct rte *rt, struct ea_list *attrs)
{
476 477
  rt->u.ospf.metric1 = ea_get_int(attrs, EA_OSPF_METRIC1, LSINFINITY);
  rt->u.ospf.metric2 = ea_get_int(attrs, EA_OSPF_METRIC2, 10000);
Ondřej Filip's avatar
Ondřej Filip committed
478
  rt->u.ospf.tag = ea_get_int(attrs, EA_OSPF_TAG, 0);
479
  rt->u.ospf.router_id = ea_get_int(attrs, EA_OSPF_ROUTER_ID, 0);
480 481
}

Ondřej Filip's avatar
Ondřej Filip committed
482
/**
483
 * ospf_shutdown - Finish of OSPF instance
484
 * @P: OSPF protocol instance
Ondřej Filip's avatar
Ondřej Filip committed
485
 *
486
 * RFC does not define any action that should be taken before router
Ondřej Filip's avatar
Ondřej Filip committed
487 488
 * shutdown. To make my neighbors react as fast as possible, I send
 * them hello packet with empty neighbor list. They should start
489
 * their neighbor state machine with event %NEIGHBOR_1WAY.
Ondřej Filip's avatar
Ondřej Filip committed
490
 */
491
static int
492
ospf_shutdown(struct proto *P)
493
{
494
  struct ospf_proto *p = (struct ospf_proto *) P;
495
  struct ospf_iface *ifa;
496

Ondřej Filip's avatar
Ondřej Filip committed
497
  OSPF_TRACE(D_EVENTS, "Shutdown requested");
498 499

  /* And send to all my neighbors 1WAY */
500
  WALK_LIST(ifa, p->iface_list)
501
    ospf_iface_shutdown(ifa);
Ondřej Filip's avatar
Ondřej Filip committed
502

503
  /* Cleanup locked rta entries */
504
  FIB_WALK(&p->rtf, ort, nf)
505
  {
506
    rta_free(nf->old_rta);
507 508 509
  }
  FIB_WALK_END;

510 511 512
  return PS_DOWN;
}

513
static void
514
ospf_get_status(struct proto *P, byte * buf)
515
{
516
  struct ospf_proto *p = (struct ospf_proto *) P;
517

518
  if (p->p.proto_state == PS_DOWN)
Ondřej Filip's avatar
Ondřej Filip committed
519
    buf[0] = 0;
520 521 522 523
  else
  {
    struct ospf_iface *ifa;
    struct ospf_neighbor *n;
Ondřej Filip's avatar
Ondřej Filip committed
524
    int adj = 0;
525

526
    WALK_LIST(ifa, p->iface_list)
Ondřej Filip's avatar
Ondřej Filip committed
527 528
      WALK_LIST(n, ifa->neigh_list) if (n->state == NEIGHBOR_FULL)
      adj = 1;
529

Ondřej Filip's avatar
Ondřej Filip committed
530 531 532 533
    if (adj == 0)
      strcpy(buf, "Alone");
    else
      strcpy(buf, "Running");
534 535 536
  }
}

Ondřej Filip's avatar
Ondřej Filip committed
537
static void
Ondřej Filip's avatar
Ondřej Filip committed
538
ospf_get_route_info(rte * rte, byte * buf, ea_list * attrs UNUSED)
Ondřej Filip's avatar
Ondřej Filip committed
539
{
Ondřej Filip's avatar
Ondřej Filip committed
540
  char *type = "<bug>";
Ondřej Filip's avatar
Ondřej Filip committed
541

542
  switch (rte->attrs->source)
Ondřej Filip's avatar
Ondřej Filip committed
543
  {
544 545 546 547 548 549 550 551 552 553 554 555
  case RTS_OSPF:
    type = "I";
    break;
  case RTS_OSPF_IA:
    type = "IA";
    break;
  case RTS_OSPF_EXT1:
    type = "E1";
    break;
  case RTS_OSPF_EXT2:
    type = "E2";
    break;
Ondřej Filip's avatar
Ondřej Filip committed
556
  }
Ondřej Filip's avatar
Ondřej Filip committed
557 558

  buf += bsprintf(buf, " %s", type);
Ondřej Filip's avatar
Ondřej Filip committed
559
  buf += bsprintf(buf, " (%d/%d", rte->pref, rte->u.ospf.metric1);
Ondřej Filip's avatar
Ondřej Filip committed
560
  if (rte->attrs->source == RTS_OSPF_EXT2)
Ondřej Filip's avatar
Ondřej Filip committed
561
    buf += bsprintf(buf, "/%d", rte->u.ospf.metric2);
Ondřej Filip's avatar
Ondřej Filip committed
562
  buf += bsprintf(buf, ")");
563
  if ((rte->attrs->source == RTS_OSPF_EXT1 || rte->attrs->source == RTS_OSPF_EXT2) && rte->u.ospf.tag)
564
  {
565
    buf += bsprintf(buf, " [%x]", rte->u.ospf.tag);
566
  }
567 568
  if (rte->u.ospf.router_id)
    buf += bsprintf(buf, " [%R]", rte->u.ospf.router_id);
Ondřej Filip's avatar
Ondřej Filip committed
569 570
}

571
static int
572
ospf_get_attr(eattr * a, byte * buf, int buflen UNUSED)
573 574
{
  switch (a->id)
Ondřej Filip's avatar
Ondřej Filip committed
575 576 577 578 579 580 581 582
  {
  case EA_OSPF_METRIC1:
    bsprintf(buf, "metric1");
    return GA_NAME;
  case EA_OSPF_METRIC2:
    bsprintf(buf, "metric2");
    return GA_NAME;
  case EA_OSPF_TAG:
583
    bsprintf(buf, "tag: 0x%08x", a->u.data);
Ondřej Filip's avatar
Ondřej Filip committed
584
    return GA_FULL;
585 586 587
  case EA_OSPF_ROUTER_ID:
    bsprintf(buf, "router_id");
    return GA_NAME;
Ondřej Filip's avatar
Ondřej Filip committed
588 589 590
  default:
    return GA_UNKNOWN;
  }
591
}
Ondřej Filip's avatar
Ondřej Filip committed
592

593 594
static void
ospf_area_reconfigure(struct ospf_area *oa, struct ospf_area_config *nac)
Ondřej Filip's avatar
Ondřej Filip committed
595
{
596 597 598 599
  struct ospf_proto *p = oa->po;
  struct ospf_area_config *oac = oa->ac;
  struct ospf_iface *ifa;

600
  oa->ac = nac;
601
  oa->options = nac->type | ospf_opts(p);
602

603 604 605 606 607 608 609
  if (nac->type != oac->type)
  {
    /* Force restart of area interfaces */
    WALK_LIST(ifa, p->iface_list)
      if (ifa->oa == oa)
	ifa->marked = 2;
  }
610 611 612

  /* Handle net_list */
  fib_free(&oa->net_fib);
613
  fib_free(&oa->enet_fib);
614 615 616 617 618
  add_area_nets(oa, nac);

  /* No need to handle stubnet_list */

  oa->marked = 0;
619
  ospf_notify_rt_lsa(oa);
Ondřej Filip's avatar
Ondřej Filip committed
620
}
621

Ondřej Filip's avatar
Ondřej Filip committed
622 623
/**
 * ospf_reconfigure - reconfiguration hook
624
 * @P: current instance of protocol (with old configuration)
Ondřej Filip's avatar
Ondřej Filip committed
625 626
 * @c: new configuration requested by user
 *
627
 * This hook tries to be a little bit intelligent. Instance of OSPF
Ondřej Filip's avatar
Ondřej Filip committed
628
 * will survive change of many constants like hello interval,
629
 * password change, addition or deletion of some neighbor on
Ondřej Filip's avatar
Ondřej Filip committed
630 631
 * nonbroadcast network, cost of interface, etc.
 */
Ondřej Filip's avatar
Ondřej Filip committed
632
static int
633
ospf_reconfigure(struct proto *P, struct proto_config *CF)
Ondřej Filip's avatar
Ondřej Filip committed
634
{
635 636
  struct ospf_proto *p = (struct ospf_proto *) P;
  struct ospf_config *old = (struct ospf_config *) (P->cf);
637
  struct ospf_config *new = (struct ospf_config *) CF;
638 639 640 641 642
  struct ospf_area_config *nac;
  struct ospf_area *oa, *oax;
  struct ospf_iface *ifa, *ifx;
  struct ospf_iface_patt *ip;

643
  if (proto_get_router_id(CF) != p->router_id)
644 645
    return 0;

646 647 648
  if (p->ospf2 != new->ospf2)
    return 0;

649
  if (p->rfc1583 != new->rfc1583)
650 651
    return 0;

652 653
  if (old->abr != new->abr)
    return 0;
Ondřej Filip's avatar
Ondřej Filip committed
654

655 656 657
  if ((p->af_ext != new->af_ext) || (p->af_mc != new->af_mc))
    return 0;

658 659 660
  if (!proto_configure_channel(P, &P->main_channel, proto_cf_main_channel(CF)))
    return 0;

661 662 663 664 665
  p->stub_router = new->stub_router;
  p->merge_external = new->merge_external;
  p->asbr = new->asbr;
  p->ecmp = new->ecmp;
  p->tick = new->tick;
666
  p->disp_timer->recurrent = p->tick S;
667
  tm_start(p->disp_timer, 100 MS);
668

669
  /* Mark all areas and ifaces */
670
  WALK_LIST(oa, p->area_list)
671
    oa->marked = 1;
Ondřej Filip's avatar
Ondřej Filip committed
672

673
  WALK_LIST(ifa, p->iface_list)
674
    ifa->marked = 1;
Ondřej Filip's avatar
Ondřej Filip committed
675

676 677
  /* Add and update areas */
  WALK_LIST(nac, new->area_list)
Ondřej Filip's avatar
Ondřej Filip committed
678
  {
679
    oa = ospf_find_area(p, nac->areaid);
680 681 682
    if (oa)
      ospf_area_reconfigure(oa, nac);
    else
683
      ospf_area_add(p, nac);
684
  }
685

686 687 688
  /* Add and update interfaces */
  ospf_reconfigure_ifaces(p);

689 690 691
  /* Add and update vlinks */
  WALK_LIST(ip, new->vlink_list)
  {
692
    ifa = ospf_find_vlink(p, ip->voa, ip->vid);
693 694 695
    if (ifa)
      ospf_iface_reconfigure(ifa, ip);
    else
696
      ospf_iface_new_vlink(p, ip);
697
  }
Ondřej Filip's avatar
Ondřej Filip committed
698

699
  /* Delete remaining ifaces and areas */
700
  WALK_LIST_DELSAFE(ifa, ifx, p->iface_list)
701
    if (ifa->marked)
Ondřej Filip's avatar
Ondřej Filip committed
702
    {
703 704
      ospf_iface_shutdown(ifa);
      ospf_iface_remove(ifa);
Ondřej Filip's avatar
Ondřej Filip committed
705 706
    }

707
  WALK_LIST_DELSAFE(oa, oax, p->area_list)
708 709
    if (oa->marked)
      ospf_area_remove(oa);
Ondřej Filip's avatar
Ondřej Filip committed
710

711
  ospf_schedule_rtcalc(p);
712

713
  return 1;
Ondřej Filip's avatar
Ondřej Filip committed
714
}
715

716

717
void
718
ospf_sh_neigh(struct proto *P, char *iff)
719
{
720
  struct ospf_proto *p = (struct ospf_proto *) P;
721
  struct ospf_iface *ifa = NULL;
722
  struct ospf_neighbor *n;
723

724
  if (p->p.proto_state != PS_UP)
725
  {
726
    cli_msg(-1013, "%s: is not up", p->p.name);
Ondřej Filip's avatar
Ondřej Filip committed
727
    cli_msg(0, "");
728 729
    return;
  }
Ondřej Filip's avatar
Ondřej Filip committed
730

731
  cli_msg(-1013, "%s:", p->p.name);
732 733
  cli_msg(-1013, "%-12s\t%3s\t%-15s\t%-5s\t%-10s %-12s", "Router ID", "Pri",
	  "     State", "DTime", "Interface", "Router IP");
734
  WALK_LIST(ifa, p->iface_list)
735
    if ((iff == NULL) || patmatch(iff, ifa->ifname))
736 737
      WALK_LIST(n, ifa->neigh_list)
	ospf_sh_neigh_info(n);
Ondřej Filip's avatar
Ondřej Filip committed
738
  cli_msg(0, "");
739
}
Ondřej Filip's avatar
Ondřej Filip committed
740 741

void
742
ospf_sh(struct proto *P)
Ondřej Filip's avatar
Ondřej Filip committed
743
{
744
  struct ospf_proto *p = (struct ospf_proto *) P;
Ondřej Filip's avatar
Ondřej Filip committed
745 746 747
  struct ospf_area *oa;
  struct ospf_iface *ifa;
  struct ospf_neighbor *n;
Ondřej Filip's avatar
Ondřej Filip committed
748
  int ifano, nno, adjno, firstfib;
Ondřej Filip's avatar
Ondřej Filip committed
749

750
  if (p->p.proto_state != PS_UP)
751
  {
752
    cli_msg(-1014, "%s: is not up", p->p.name);
Ondřej Filip's avatar
Ondřej Filip committed
753
    cli_msg(0, "");
754 755 756
    return;
  }

757
  cli_msg(-1014, "%s:", p->p.name);
758
  cli_msg(-1014, "RFC1583 compatibility: %s", (p->rfc1583 ? "enabled" : "disabled"));
759 760 761 762
  cli_msg(-1014, "Stub router: %s", (p->stub_router ? "Yes" : "No"));
  cli_msg(-1014, "RT scheduler tick: %d", p->tick);
  cli_msg(-1014, "Number of areas: %u", p->areano);
  cli_msg(-1014, "Number of LSAs in DB:\t%u", p->gr->hash_entries);
Ondřej Filip's avatar
Ondřej Filip committed
763

764
  WALK_LIST(oa, p->area_list)
Ondřej Filip's avatar
Ondřej Filip committed
765
  {
766
    cli_msg(-1014, "\tArea: %R (%u) %s", oa->areaid, oa->areaid,
Ondřej Filip's avatar
Ondřej Filip committed
767 768 769 770
	    oa->areaid == 0 ? "[BACKBONE]" : "");
    ifano = 0;
    nno = 0;
    adjno = 0;
771
    WALK_LIST(ifa, p->iface_list)
Ondřej Filip's avatar
Ondřej Filip committed
772
    {
Ondřej Filip's avatar
Ondřej Filip committed
773
      if (oa == ifa->oa)
Ondřej Filip's avatar
Ondřej Filip committed
774
      {
775
	ifano++;
776 777
	WALK_LIST(n, ifa->neigh_list)
	{
778 779 780
	  nno++;
	  if (n->state == NEIGHBOR_FULL)
	    adjno++;
781
	}
Ondřej Filip's avatar
Ondřej Filip committed
782 783
      }
    }
784 785 786

    cli_msg(-1014, "\t\tStub:\t%s", oa_is_stub(oa) ? "Yes" : "No");
    cli_msg(-1014, "\t\tNSSA:\t%s", oa_is_nssa(oa) ? "Yes" : "No");
787
    cli_msg(-1014, "\t\tTransit:\t%s", oa->trcap ? "Yes" : "No");
788 789 790 791

    if (oa_is_nssa(oa))
      cli_msg(-1014, "\t\tNSSA translation:\t%s%s", oa->translate ? "Yes" : "No",
	      oa->translate == TRANS_WAIT ? " (run down)" : "");
Ondřej Filip's avatar
Ondřej Filip committed
792 793 794
    cli_msg(-1014, "\t\tNumber of interfaces:\t%u", ifano);
    cli_msg(-1014, "\t\tNumber of neighbors:\t%u", nno);
    cli_msg(-1014, "\t\tNumber of adjacent neighbors:\t%u", adjno);
Ondřej Filip's avatar
Ondřej Filip committed
795 796

    firstfib = 1;
797
    FIB_WALK(&oa->net_fib, struct area_net, anet)
798
    {
Ondřej Filip's avatar
Ondřej Filip committed
799
      if(firstfib)
800
      {
801 802
	cli_msg(-1014, "\t\tArea networks:");
	firstfib = 0;
803
      }
804
      cli_msg(-1014, "\t\t\t%1N\t%s\t%s", anet->fn.addr,
Ondřej Filip's avatar
Ondřej Filip committed
805
		anet->hidden ? "Hidden" : "Advertise", anet->active ? "Active" : "");
806
    }
Ondřej Filip's avatar
Ondřej Filip committed
807
    FIB_WALK_END;
808 809

    firstfib = 1;
810
    FIB_WALK(&oa->enet_fib, struct area_net, anet)
811 812 813
    {
      if(firstfib)
      {
814 815
	cli_msg(-1014, "\t\tArea external networks:");
	firstfib = 0;
816
      }
817
      cli_msg(-1014, "\t\t\t%1N\t%s\t%s", anet->fn.addr,
818 819 820 821
		anet->hidden ? "Hidden" : "Advertise", anet->active ? "Active" : "");
    }
    FIB_WALK_END;

Ondřej Filip's avatar
Ondřej Filip committed
822
  }
Ondřej Filip's avatar
Ondřej Filip committed
823
  cli_msg(0, "");
Ondřej Filip's avatar
Ondřej Filip committed
824 825
}

826
void
827
ospf_sh_iface(struct proto *P, char *iff)
828
{
829
  struct ospf_proto *p = (struct ospf_proto *) P;
830
  struct ospf_iface *ifa = NULL;
831

832
  if (p->p.proto_state != PS_UP)
833
  {
834
    cli_msg(-1015, "%s: is not up", p->p.name);
Ondřej Filip's avatar
Ondřej Filip committed
835
    cli_msg(0, "");
836 837 838
    return;
  }

839 840
  cli_msg(-1015, "%s:", p->p.name);
  WALK_LIST(ifa, p->iface_list)
841
    if ((iff == NULL) || patmatch(iff, ifa->ifname))
842
      ospf_iface_info(ifa);
Ondřej Filip's avatar
Ondřej Filip committed
843
  cli_msg(0, "");
844 845
}

846 847 848
/* lsa_compare_for_state() - Compare function for 'show ospf state'
 *
 * First we want to separate network-LSAs and other LSAs (because network-LSAs
849 850 851 852
 * will be presented as network nodes and other LSAs together as router nodes)
 * Network-LSAs are sorted according to network prefix, other LSAs are sorted
 * according to originating router id (to get all LSA needed to represent one
 * router node together). Then, according to LSA type, ID and age.
853 854 855 856
 *
 * For OSPFv3, we have to handle also Prefix-LSAs. We would like to put each
 * immediately after the referenced LSA. We will make faked LSA based on ref_
 * values
857
 */
858 859 860 861 862 863

static struct ospf_lsa_header *
fake_lsa_from_prefix_lsa(struct ospf_lsa_header *dst, struct ospf_lsa_header *src,
			 struct ospf_lsa_prefix *px)
{
  dst->age = src->age;
864
  dst->type_raw = px->ref_type;
865 866 867 868 869 870 871
  dst->id = px->ref_id;
  dst->rt = px->ref_rt;
  dst->sn = src->sn;

  return dst;
}

872 873

static int lsa_compare_ospf3;
Ondřej Zajíček's avatar
Ondřej Zajíček committed
874

875
static int
876
lsa_compare_for_state(const void *p1, const void *p2)
877
{
878 879
  struct top_hash_entry *he1 = * (struct top_hash_entry **) p1;
  struct top_hash_entry *he2 = * (struct top_hash_entry **) p2;
880 881
  struct ospf_lsa_header *lsa1 = &(he1->lsa);
  struct ospf_lsa_header *lsa2 = &(he2->lsa);
882 883 884
  struct ospf_lsa_header lsatmp1, lsatmp2;
  u16 lsa1_type = he1->lsa_type;
  u16 lsa2_type = he2->lsa_type;
885

886 887 888 889
  if (he1->domain < he2->domain)
    return -1;
  if (he1->domain > he2->domain)
    return 1;
890 891


892 893 894
  /* px1 or px2 assumes OSPFv3 */
  int px1 = (lsa1_type == LSA_T_PREFIX);
  int px2 = (lsa2_type == LSA_T_PREFIX);
895 896

  if (px1)
897
  {
898
    lsa1 = fake_lsa_from_prefix_lsa(&lsatmp1, lsa1, he1->lsa_body);
899 900
    lsa1_type = lsa1->type_raw;	/* FIXME: handle unknown ref_type */
  }
901 902

  if (px2)
903
  {
904
    lsa2 = fake_lsa_from_prefix_lsa(&lsatmp2, lsa2, he2->lsa_body);
905 906 907
    lsa2_type = lsa2->type_raw;
  }

908

909 910
  int nt1 = (lsa1_type == LSA_T_NET);
  int nt2 = (lsa2_type == LSA_T_NET);
911 912 913 914 915 916

  if (nt1 != nt2)
    return nt1 - nt2;

  if (nt1)
  {
917 918 919 920 921 922 923 924
    /* In OSPFv3, networks are named based on ID of DR */
    if (lsa_compare_ospf3)
    {
      if (lsa1->rt < lsa2->rt)
	return -1;
      if (lsa1->rt > lsa2->rt)
	return 1;
    }
925 926 927

    /* For OSPFv2, this is IP of the network,
       for OSPFv3, this is interface ID */
928 929 930 931
    if (lsa1->id < lsa2->id)
      return -1;
    if (lsa1->id > lsa2->id)
      return 1;
932 933 934 935 936

    if (px1 != px2)
      return px1 - px2;

    return lsa1->sn - lsa2->sn;
937
  }
938
  else
939
  {
940 941 942 943
    if (lsa1->rt < lsa2->rt)
      return -1;
    if (lsa1->rt > lsa2->rt)
      return 1;
944

945
    if (lsa1_type < lsa2_type)
946
      return -1;
947
    if (lsa1_type > lsa2_type)
948 949 950 951 952 953
      return 1;

    if (lsa1->id < lsa2->id)
      return -1;
    if (lsa1->id > lsa2->id)
      return 1;
954 955 956

    if (px1 != px2)
      return px1 - px2;
957

958 959
    return lsa1->sn - lsa2->sn;
  }
960
}
961

962 963 964 965 966 967 968 969
static int
ext_compare_for_state(const void *p1, const void *p2)
{
  struct top_hash_entry * he1 = * (struct top_hash_entry **) p1;
  struct top_hash_entry * he2 = * (struct top_hash_entry **) p2;
  struct ospf_lsa_header *lsa1 = &(he1->lsa);
  struct ospf_lsa_header *lsa2 = &(he2->lsa);

970 971 972 973 974 975 976 977 978
  if (lsa1->rt < lsa2->rt)
    return -1;
  if (lsa1->rt > lsa2->rt)
    return 1;

  if (lsa1->id < lsa2->id)
    return -1;
  if (lsa1->id > lsa2->id)
    return 1;
979 980 981 982 983 984 985 986 987 988 989 990 991

  return lsa1->sn - lsa2->sn;
}

static inline void
show_lsa_distance(struct top_hash_entry *he)
{
  if (he->color == INSPF)
    cli_msg(-1016, "\t\tdistance %u", he->dist);
  else
    cli_msg(-1016, "\t\tunreachable");
}

992
static inline void
993
show_lsa_router(struct ospf_proto *p, struct top_hash_entry *he, int verbose)
994
{
995
  struct ospf_lsa_rt_walk rtl;
996

997 998 999
  cli_msg(-1016, "");
  cli_msg(-1016, "\trouter %R", he->lsa.rt);
  show_lsa_distance(he);
1000

1001 1002 1003 1004
  lsa_walk_rt_init(p, he, &rtl);
  while (lsa_walk_rt(&rtl))
    if (rtl.type == LSART_VLNK)
      cli_msg(-1016, "\t\tvlink %R metric %u", rtl.id, rtl.metric);
1005

1006 1007 1008 1009
  lsa_walk_rt_init(p, he, &rtl);
  while (lsa_walk_rt(&rtl))
    if (rtl.type == LSART_PTP)
      cli_msg(-1016, "\t\trouter %R metric %u", rtl.id, rtl.metric);
1010

1011 1012 1013
  lsa_walk_rt_init(p, he, &rtl);
  while (lsa_walk_rt(&rtl))
    if (rtl.type == LSART_NET)
1014
    {
1015
      if (ospf_is_v2(p))
1016
      {
1017 1018
	/* In OSPFv2, we try to find network-LSA to get prefix/pxlen */
	struct top_hash_entry *net_he = ospf_hash_find_net2(p->gr, he->domain, rtl.id);
1019

1020
	if (net_he && (net_he->lsa.age < LSA_MAXAGE))
1021 1022 1023 1024
	{
	  struct ospf_lsa_header *net_lsa = &(net_he->lsa);
	  struct ospf_lsa_net *net_ln = net_he->lsa_body;

1025
	  cli_msg(-1016, "\t\tnetwork %I/%d metric %u",
1026 1027 1028 1029 1030
		  ipa_from_u32(net_lsa->id & net_ln->optx),
		  u32_masklen(net_ln->optx), rtl.metric);
	}
	else
	  cli_msg(-1016, "\t\tnetwork [%R] metric %u", rtl.id, rtl.metric);
1031 1032
      }
      else
1033
	cli_msg(-1016, "\t\tnetwork [%R-%u] metric %u", rtl.id, rtl.nif, rtl.metric);
1034 1035
    }

1036 1037 1038 1039 1040 1041 1042 1043
  if (ospf_is_v2(p) && verbose)
  {
    lsa_walk_rt_init(p, he, &rtl);
    while (lsa_walk_rt(&rtl))
      if (rtl.type == LSART_STUB)
	cli_msg(-1016, "\t\tstubnet %I/%d metric %u",
		ipa_from_u32(rtl.id), u32_masklen(rtl.data), rtl.metric);
  }
1044 1045 1046
}

static inline void
1047
show_lsa_network(struct top_hash_entry *he, int ospf2)
1048 1049 1050 1051 1052
{
  struct ospf_lsa_header *lsa = &(he->lsa);
  struct ospf_lsa_net *ln = he->lsa_body;
  u32 i;

1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063
  if (ospf2)
  {
    cli_msg(-1016, "");
    cli_msg(-1016, "\tnetwork %I/%d", ipa_from_u32(lsa->id & ln->optx), u32_masklen(ln->optx));
    cli_msg(-1016, "\t\tdr %R", lsa->rt);
  }
  else
  {
    cli_msg(-1016, "");
    cli_msg(-1016, "\tnetwork [%R-%u]", lsa->rt, lsa->id);
  }
1064

1065 1066
  show_lsa_distance(he);

1067
  for (i = 0; i < lsa_net_count(lsa); i++)
1068
    cli_msg(-1016, "\t\trouter %R", ln->routers[i]);
1069 1070 1071
}

static inline void
1072
show_lsa_sum_net(struct top_hash_entry *he, int ospf2, int af)
1073
{
1074
  net_addr net;
1075
  u8 pxopts;
1076
  u32 metric;
1077

1078
  lsa_parse_sum_net(he, ospf2, af, &net, &pxopts, &metric);
1079
  cli_msg(-1016, "\t\txnetwork %N metric %u", &net, metric);
1080 1081 1082
}

static inline void
Ondřej Zajíček's avatar <