diff options
author | Maria Matejka <mq@ucw.cz> | 2022-04-20 13:56:04 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-05-04 15:39:21 +0200 |
commit | 8ebac84bc8d51e2404ce6d6dc5e35fb261830596 (patch) | |
tree | ddf072a6ba02df9647f02e9203a8e4b3f214e108 /proto/rip | |
parent | 337c04c45e1472d6d9b531a3c55f1f2d30ebf308 (diff) |
Moved advertising router info (FROM attribute) to eattrs
Diffstat (limited to 'proto/rip')
-rw-r--r-- | proto/rip/rip.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 244bcd0a..7c097a92 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -157,7 +157,18 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en) .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 +200,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)); rta *a = rta_lookup(&a0); rte *e = rte_get_temp(a, p->p.main_source); |