diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-04-25 15:50:57 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-04-25 15:54:53 +0200 |
commit | 4727d1db9d83a8f1025481cbcc06a7e4c8ec9f33 (patch) | |
tree | 8b0778f352da5135c6dc75d0389e0270202537de /proto/ospf/hello.c | |
parent | f3a8cf050e6181e158dcde2fe885d7bf220eedc3 (diff) |
OSPF: Support of authentication trailer for OSPFv3
Implement RFC 7166, crypthographic authentication for OSPFv3
analogous to authentication used for OSPFv2.
Diffstat (limited to 'proto/ospf/hello.c')
-rw-r--r-- | proto/ospf/hello.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c index e706ea0f..523c24ad 100644 --- a/proto/ospf/hello.c +++ b/proto/ospf/hello.c @@ -14,7 +14,7 @@ struct ospf_hello2_packet { struct ospf_packet hdr; - union ospf_auth auth; + union ospf_auth2 auth; u32 netmask; u16 helloint; @@ -42,6 +42,13 @@ struct ospf_hello3_packet }; +uint +ospf_hello3_options(struct ospf_packet *pkt) +{ + struct ospf_hello3_packet *ps = (void *) pkt; + return ntohl(ps->options) & 0x00FFFFFF; +} + void ospf_send_hello(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn) { @@ -86,9 +93,10 @@ ospf_send_hello(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn) else { struct ospf_hello3_packet *ps = (void *) pkt; + u32 options = ifa->oa->options | (ifa->autype == OSPF_AUTH_CRYPT ? OPT_AT : 0); ps->iface_id = htonl(ifa->iface_id); - ps->options = ntohl(ifa->oa->options | (ifa->priority << 24)); + ps->options = ntohl(options | (ifa->priority << 24)); ps->helloint = ntohs(ifa->helloint); ps->deadint = htons(ifa->deadint); ps->dr = htonl(ifa->drid); @@ -334,7 +342,6 @@ ospf_receive_hello(struct ospf_packet *pkt, struct ospf_iface *ifa, n->priority = rcv_priority; n->iface_id = rcv_iface_id; - /* Update inactivity timer */ ospf_neigh_sm(n, INM_HELLOREC); |