summaryrefslogtreecommitdiff
path: root/proto/ospf/dbdes.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-04-25 15:50:57 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-04-25 15:54:53 +0200
commit4727d1db9d83a8f1025481cbcc06a7e4c8ec9f33 (patch)
tree8b0778f352da5135c6dc75d0389e0270202537de /proto/ospf/dbdes.c
parentf3a8cf050e6181e158dcde2fe885d7bf220eedc3 (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/dbdes.c')
-rw-r--r--proto/ospf/dbdes.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c
index f211935f..2626a24c 100644
--- a/proto/ospf/dbdes.c
+++ b/proto/ospf/dbdes.c
@@ -14,7 +14,7 @@
struct ospf_dbdes2_packet
{
struct ospf_packet hdr;
- union ospf_auth auth;
+ union ospf_auth2 auth;
u16 iface_mtu;
u8 options;
@@ -38,6 +38,13 @@ struct ospf_dbdes3_packet
};
+uint
+ospf_dbdes3_options(struct ospf_packet *pkt)
+{
+ struct ospf_dbdes3_packet *ps = (void *) pkt;
+ return ntohl(ps->options);
+}
+
static inline uint
ospf_dbdes_hdrlen(struct ospf_proto *p)
{
@@ -45,7 +52,6 @@ ospf_dbdes_hdrlen(struct ospf_proto *p)
sizeof(struct ospf_dbdes2_packet) : sizeof(struct ospf_dbdes3_packet);
}
-
static void
ospf_dbdes_body(struct ospf_proto *p, struct ospf_packet *pkt,
struct ospf_lsa_header **body, uint *count)
@@ -129,7 +135,7 @@ ospf_prepare_dbdes(struct ospf_proto *p, struct ospf_neighbor *n)
else /* OSPFv3 */
{
struct ospf_dbdes3_packet *ps = (void *) pkt;
- ps->options = htonl(ifa->oa->options);
+ ps->options = htonl(ifa->oa->options | (ifa->autype == OSPF_AUTH_CRYPT ? OPT_AT : 0));
ps->iface_mtu = htons(iface_mtu);
ps->padding = 0;
ps->imms = 0; /* Will be set later */