summaryrefslogtreecommitdiffstats
path: root/proto/ospf/ospf.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-10-15 00:28:04 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-10-15 00:28:04 +0200
commitb66abe8ef986698caccd08b38a991330f0791075 (patch)
treef5b8fc17395f7f6f74f7e50bfc84272ed01b2eb3 /proto/ospf/ospf.h
parentd82fc18d75e4ebf615657cb5d98f000c728b13e4 (diff)
downloadbird-b66abe8ef986698caccd08b38a991330f0791075.tar
bird-b66abe8ef986698caccd08b38a991330f0791075.zip
Reimplements 'show ospf state' for OSPFv3 and fixes some bugs.
Diffstat (limited to 'proto/ospf/ospf.h')
-rw-r--r--proto/ospf/ospf.h42
1 files changed, 40 insertions, 2 deletions
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index d85ebdc..e89769d 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -523,19 +523,57 @@ struct ospf_lsa_prefix
#define METRIC_MASK 0x00FFFFFF
#define OPTIONS_MASK 0x00FFFFFF
-static inline unsigned lsa_rt_count(struct ospf_lsa_header *lsa)
+static inline unsigned
+lsa_rt_count(struct ospf_lsa_header *lsa)
{
return (lsa->length - sizeof(struct ospf_lsa_header) - sizeof(struct ospf_lsa_rt))
/ sizeof(struct ospf_lsa_rt_link);
}
-static inline unsigned lsa_net_count(struct ospf_lsa_header *lsa)
+static inline unsigned
+lsa_net_count(struct ospf_lsa_header *lsa)
{
return (lsa->length - sizeof(struct ospf_lsa_header) - sizeof(struct ospf_lsa_net))
/ sizeof(u32);
}
+#ifdef OSPFv3
+
+static inline u32 *
+lsa_get_ipv6_prefix(u32 *buf, ip_addr *addr, int *pxlen, u8 *pxopts, u16 *rest)
+{
+ u8 pxl = (*buf >> 24);
+ *pxopts = (*buf >> 16);
+ *rest = *buf;
+ *pxlen = pxl;
+ buf++;
+
+ *addr = IPA_NONE;
+
+ if (pxl > 0)
+ _I0(*addr) = *buf++;
+ if (pxl > 32)
+ _I1(*addr) = *buf++;
+ if (pxl > 64)
+ _I2(*addr) = *buf++;
+ if (pxl > 96)
+ _I3(*addr) = *buf++;
+
+ return buf;
+}
+
+static inline u32 *
+lsa_get_ipv6_addr(u32 *buf, ip_addr *addr)
+{
+ *addr = *(ip_addr *) buf;
+ return buf + 4;
+}
+
+#endif
+
+
+
struct ospf_lsreq_header
{
u32 type;