From 4727d1db9d83a8f1025481cbcc06a7e4c8ec9f33 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Wed, 25 Apr 2018 15:50:57 +0200 Subject: OSPF: Support of authentication trailer for OSPFv3 Implement RFC 7166, crypthographic authentication for OSPFv3 analogous to authentication used for OSPFv2. --- proto/ospf/hello.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'proto/ospf/hello.c') 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); -- cgit v1.2.3