summaryrefslogtreecommitdiff
path: root/proto/babel
diff options
context:
space:
mode:
Diffstat (limited to 'proto/babel')
-rw-r--r--proto/babel/babel.c7
-rw-r--r--proto/babel/packets.c8
2 files changed, 7 insertions, 8 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index 618abaa8..4b6b9d7f 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -113,7 +113,7 @@ babel_get_source(struct babel_proto *p, struct babel_entry *e, u64 router_id)
if (s)
return s;
- s = sl_alloc(p->source_slab);
+ s = sl_allocz(p->source_slab);
s->router_id = router_id;
s->expires = current_time() + BABEL_GARBAGE_INTERVAL;
s->seqno = 0;
@@ -159,8 +159,7 @@ babel_get_route(struct babel_proto *p, struct babel_entry *e, struct babel_neigh
if (r)
return r;
- r = sl_alloc(p->route_slab);
- memset(r, 0, sizeof(*r));
+ r = sl_allocz(p->route_slab);
r->e = e;
r->neigh = nbr;
@@ -323,7 +322,7 @@ babel_add_seqno_request(struct babel_proto *p, struct babel_entry *e,
}
/* No entries found */
- sr = sl_alloc(p->seqno_slab);
+ sr = sl_allocz(p->seqno_slab);
found:
sr->router_id = router_id;
diff --git a/proto/babel/packets.c b/proto/babel/packets.c
index d4ecf649..415ac3f9 100644
--- a/proto/babel/packets.c
+++ b/proto/babel/packets.c
@@ -1144,7 +1144,6 @@ babel_read_tlv(struct babel_tlv *hdr,
return PARSE_ERROR;
state->current_tlv_endpos = tlv_data[hdr->type].min_length;
- memset(msg, 0, sizeof(*msg));
int res = tlv_data[hdr->type].read_tlv(hdr, msg, state);
if (res != PARSE_SUCCESS)
@@ -1278,7 +1277,7 @@ babel_send_unicast(union babel_msg *msg, struct babel_iface *ifa, ip_addr dest)
struct babel_msg_node *msgn = sl_alloc(p->msg_slab);
list queue;
- msgn->msg = *msg;
+ *msgn = (struct babel_msg_node) { .msg = *msg };
init_list(&queue);
add_tail(&queue, NODE msgn);
babel_write_queue(ifa, &queue);
@@ -1305,7 +1304,8 @@ babel_enqueue(union babel_msg *msg, struct babel_iface *ifa)
{
struct babel_proto *p = ifa->proto;
struct babel_msg_node *msgn = sl_alloc(p->msg_slab);
- msgn->msg = *msg;
+
+ *msgn = (struct babel_msg_node) { .msg = *msg };
add_tail(&ifa->msg_queue, NODE msgn);
babel_kick_queue(ifa);
}
@@ -1386,7 +1386,7 @@ babel_process_packet(struct babel_pkt_header *pkt, int len,
break;
}
- msg = sl_alloc(p->msg_slab);
+ msg = sl_allocz(p->msg_slab);
res = babel_read_tlv(tlv, &msg->msg, &state);
if (res == PARSE_SUCCESS)
{