version 1.1, 2017/08/22 12:33:54
|
version 1.1.1.2, 2021/03/17 19:50:23
|
Line 40 struct babel_tlv_ack {
|
Line 40 struct babel_tlv_ack {
|
struct babel_tlv_hello { |
struct babel_tlv_hello { |
u8 type; |
u8 type; |
u8 length; |
u8 length; |
u16 reserved; | u16 flags; |
u16 seqno; |
u16 seqno; |
u16 interval; |
u16 interval; |
} PACKED; |
} PACKED; |
Line 104 struct babel_tlv_seqno_request {
|
Line 104 struct babel_tlv_seqno_request {
|
} PACKED; |
} PACKED; |
|
|
|
|
#define BABEL_FLAG_DEF_PREFIX 0x80 | /* Hello flags */ |
#define BABEL_FLAG_ROUTER_ID 0x40 | #define BABEL_HF_UNICAST 0x8000 |
|
|
|
/* Update flags */ |
|
#define BABEL_UF_DEF_PREFIX 0x80 |
|
#define BABEL_UF_ROUTER_ID 0x40 |
|
|
|
|
struct babel_parse_state { |
struct babel_parse_state { |
struct babel_proto *proto; |
struct babel_proto *proto; |
struct babel_iface *ifa; |
struct babel_iface *ifa; |
Line 146 struct babel_write_state {
|
Line 150 struct babel_write_state {
|
#define TLV_HDR(tlv,t,l) ({ tlv->type = t; tlv->length = l - sizeof(struct babel_tlv); }) |
#define TLV_HDR(tlv,t,l) ({ tlv->type = t; tlv->length = l - sizeof(struct babel_tlv); }) |
#define TLV_HDR0(tlv,t) TLV_HDR(tlv, t, tlv_data[t].min_length) |
#define TLV_HDR0(tlv,t) TLV_HDR(tlv, t, tlv_data[t].min_length) |
|
|
#define BYTES(n) ((((uint) n) + 7) / 8) |
|
|
|
static inline u16 |
static inline u16 |
get_time16(const void *p) |
get_time16(const void *p) |
{ |
{ |
Line 312 babel_read_hello(struct babel_tlv *hdr, union babel_ms
|
Line 314 babel_read_hello(struct babel_tlv *hdr, union babel_ms
|
struct babel_tlv_hello *tlv = (void *) hdr; |
struct babel_tlv_hello *tlv = (void *) hdr; |
struct babel_msg_hello *msg = &m->hello; |
struct babel_msg_hello *msg = &m->hello; |
|
|
|
/* We currently don't support unicast Hello */ |
|
u16 flags = get_u16(&tlv->flags); |
|
if (flags & BABEL_HF_UNICAST) |
|
return PARSE_IGNORE; |
|
|
msg->type = BABEL_TLV_HELLO; |
msg->type = BABEL_TLV_HELLO; |
msg->seqno = get_u16(&tlv->seqno); |
msg->seqno = get_u16(&tlv->seqno); |
msg->interval = get_time16(&tlv->interval); |
msg->interval = get_time16(&tlv->interval); |
Line 502 babel_read_update(struct babel_tlv *hdr, union babel_m
|
Line 509 babel_read_update(struct babel_tlv *hdr, union babel_m
|
msg->plen = tlv->plen; |
msg->plen = tlv->plen; |
msg->prefix = ipa_from_ip6(get_ip6(buf)); |
msg->prefix = ipa_from_ip6(get_ip6(buf)); |
|
|
if (tlv->flags & BABEL_FLAG_DEF_PREFIX) | if (tlv->flags & BABEL_UF_DEF_PREFIX) |
{ |
{ |
put_ip6(state->def_ip6_prefix, msg->prefix); |
put_ip6(state->def_ip6_prefix, msg->prefix); |
state->def_ip6_prefix_seen = 1; |
state->def_ip6_prefix_seen = 1; |
} |
} |
|
|
if (tlv->flags & BABEL_FLAG_ROUTER_ID) | if (tlv->flags & BABEL_UF_ROUTER_ID) |
{ |
{ |
state->router_id = ((u64) _I2(msg->prefix)) << 32 | _I3(msg->prefix); |
state->router_id = ((u64) _I2(msg->prefix)) << 32 | _I3(msg->prefix); |
state->router_id_seen = 1; |
state->router_id_seen = 1; |
Line 1080 babel_open_socket(struct babel_iface *ifa)
|
Line 1087 babel_open_socket(struct babel_iface *ifa)
|
sk->sport = ifa->cf->port; |
sk->sport = ifa->cf->port; |
sk->dport = ifa->cf->port; |
sk->dport = ifa->cf->port; |
sk->iface = ifa->iface; |
sk->iface = ifa->iface; |
|
sk->saddr = ifa->addr; |
|
sk->vrf = p->p.vrf; |
|
|
sk->rx_hook = babel_rx_hook; |
sk->rx_hook = babel_rx_hook; |
sk->tx_hook = babel_tx_hook; |
sk->tx_hook = babel_tx_hook; |