diff options
author | Maria Matejka <mq@ucw.cz> | 2022-05-30 17:18:46 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-05-30 17:18:46 +0200 |
commit | 65254128e105903b6b470c6b4bb4729f56cf81bc (patch) | |
tree | 8f0e61f94053f49428531f0d8cd6e8d1abfcdb2a /proto/rip | |
parent | 1a92ee9d4df265018c0344064019f53bc3afce3a (diff) | |
parent | 702c04fbef222e802ca4dfac645dc75ede522db6 (diff) |
Merge commit '702c04fbef222e802ca4dfac645dc75ede522db6' into haugesund
Diffstat (limited to 'proto/rip')
-rw-r--r-- | proto/rip/config.Y | 2 | ||||
-rw-r--r-- | proto/rip/rip.c | 41 |
2 files changed, 21 insertions, 22 deletions
diff --git a/proto/rip/config.Y b/proto/rip/config.Y index 234e9029..3c0973b1 100644 --- a/proto/rip/config.Y +++ b/proto/rip/config.Y @@ -37,7 +37,7 @@ CF_KEYWORDS(RIP, NG, ECMP, LIMIT, WEIGHT, INFINITY, METRIC, UPDATE, TIMEOUT, PASSIVE, VERSION, SPLIT, HORIZON, POISON, REVERSE, CHECK, ZERO, TIME, BFD, AUTHENTICATION, NONE, PLAINTEXT, CRYPTOGRAPHIC, MD5, TTL, SECURITY, RX, TX, BUFFER, LENGTH, PRIORITY, ONLY, LINK, - DEMAND, CIRCUIT, RIP_METRIC, RIP_TAG) + DEMAND, CIRCUIT) %type <i> rip_variant rip_auth diff --git a/proto/rip/rip.c b/proto/rip/rip.c index cf186f87..1c7d1f1f 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -153,11 +153,21 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en) /* Update */ rta a0 = { .source = RTS_RIP, - .scope = SCOPE_UNIVERSE, .dest = RTD_UNICAST, }; - u8 rt_metric = rt->metric; + struct { + ea_list l; + eattr a[2]; + } ea_block = { + .l.count = ARRAY_SIZE(ea_block.a), + .a = { + EA_LITERAL_EMBEDDED(&ea_gen_preference, 0, p->p.main_channel->preference), + EA_LITERAL_EMBEDDED(&ea_rip_metric, 0, rt->metric), + }, + }; + a0.eattrs = &ea_block.l; + u16 rt_tag = rt->tag; if (p->ecmp) @@ -189,30 +199,19 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en) else { /* Unipath route */ - a0.from = rt->from->nbr->addr; a0.nh.gw = rt->next_hop; a0.nh.iface = rt->from->ifa->iface; + ea_set_attr_data(&a0.eattrs, &ea_gen_from, 0, &rt->from->nbr->addr, sizeof(ip_addr)); } - struct { - ea_list l; - eattr a[4]; - struct rip_iface_adata riad; - } ea_block = { - .l.count = ARRAY_SIZE(ea_block.a), - .a = { - EA_LITERAL_EMBEDDED(&ea_gen_preference, 0, p->p.main_channel->preference), - EA_LITERAL_EMBEDDED(&ea_rip_metric, 0, rt_metric), - EA_LITERAL_EMBEDDED(&ea_rip_tag, 0, rt_tag), - EA_LITERAL_DIRECT_ADATA(&ea_rip_from, 0, &ea_block.riad.ad), - }, - .riad = { - .ad = { .length = sizeof(struct rip_iface_adata) - sizeof(struct adata) }, - .iface = a0.nh.iface, - }, - }; + ea_set_attr_u32(&a0.eattrs, &ea_rip_tag, 0, rt_tag); - a0.eattrs = &ea_block.l; + struct rip_iface_adata riad = { + .ad = { .length = sizeof(struct rip_iface_adata) - sizeof(struct adata) }, + .iface = a0.nh.iface, + }; + ea_set_attr(&a0.eattrs, + EA_LITERAL_DIRECT_ADATA(&ea_rip_from, 0, &riad.ad)); rte e0 = { .attrs = &a0, |