summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/babel/babel.c4
-rw-r--r--proto/bgp/packets.c3
-rw-r--r--proto/rip/rip.c40
3 files changed, 24 insertions, 23 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index afd0b1e1..f4503b99 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -645,11 +645,12 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
{
struct {
ea_list l;
- eattr a[4];
+ eattr a[5];
} eattrs = {
.l.count = ARRAY_SIZE(eattrs.a),
.a = {
EA_LITERAL_EMBEDDED(&ea_gen_preference, 0, c->preference),
+ EA_LITERAL_STORE_ADATA(&ea_gen_from, 0, &r->neigh->addr, sizeof(r->neigh->addr)),
EA_LITERAL_EMBEDDED(&ea_babel_metric, 0, r->metric),
EA_LITERAL_STORE_ADATA(&ea_babel_router_id, 0, &r->router_id, sizeof(r->router_id)),
EA_LITERAL_EMBEDDED(&ea_babel_seqno, 0, r->seqno),
@@ -660,7 +661,6 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
.source = RTS_BABEL,
.scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
- .from = r->neigh->addr,
.nh.gw = r->next_hop,
.nh.iface = r->neigh->ifa->iface,
.eattrs = &eattrs.l,
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 45a4b1de..9760ebee 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -2476,8 +2476,9 @@ bgp_decode_nlri(struct bgp_parse_state *s, u32 afi, byte *nlri, uint len, ea_lis
a->source = RTS_BGP;
a->scope = SCOPE_UNIVERSE;
- a->from = s->proto->remote_ip;
a->eattrs = ea;
+
+ ea_set_attr_data(&a->eattrs, &ea_gen_from, 0, &s->proto->remote_ip, sizeof(ip_addr));
ea_set_attr_u32(&a->eattrs, &ea_gen_preference, 0, c->c.preference);
c->desc->decode_next_hop(s, nh, nh_len, a);
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);