summaryrefslogtreecommitdiff
path: root/proto/ospf
diff options
context:
space:
mode:
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/ospf.h33
-rw-r--r--proto/ospf/packet.c3
-rw-r--r--proto/ospf/rt.c4
-rw-r--r--proto/ospf/topology.c2
4 files changed, 10 insertions, 32 deletions
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index 6df5df08..e535287c 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -37,36 +37,9 @@
#endif
-#define IP4_MIN_MTU 576
-#define IP6_MIN_MTU 1280
-
-#define IP4_OSPF_ALL_ROUTERS ipa_build4(224, 0, 0, 5)
-#define IP4_OSPF_DES_ROUTERS ipa_build4(224, 0, 0, 6)
-
-#define IP6_OSPF_ALL_ROUTERS ipa_build6(0xFF020000, 0, 0, 5)
-#define IP6_OSPF_DES_ROUTERS ipa_build6(0xFF020000, 0, 0, 6)
-
#ifdef IPV6
-#define ip4_addr u32
-#define ip6_addr ip_addr
-#define _MI6(x1,x2,x3,x4) _MI(x1, x2, x3, x4)
-#define ipa_is_link_local(x) ipa_has_link_scope(x)
-#define ipa_from_u32(x) _MI6(0,0,0xffff,x)
-#define ipa_to_u32(x) _I3(x)
-#define ipa_build4(a,b,c,d) IPA_NONE
-#define ipa_build6(a,b,c,d) _MI6(a,b,c,d)
#define OSPF_IS_V2 0
#else
-#define ip4_addr u32
-#define ip6_addr ip_addr
-#define _I0(X) 0
-#define _I1(X) 0
-#define _I2(X) 0
-#define _I3(X) 0
-#define _MI6(x1,x2,x3,x4) IPA_NONE
-#define ipa_is_link_local(x) 0
-#define ipa_build4(a,b,c,d) _MI(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
-#define ipa_build6(a,b,c,d) IPA_NONE
#define OSPF_IS_V2 1
#endif
@@ -744,10 +717,12 @@ lsa_net_count(struct ospf_lsa_header *lsa)
#define ipa_from_rid(x) ipa_from_u32(x)
#define ipa_to_rid(x) ipa_to_u32(x)
-
#define IPV6_PREFIX_SPACE(x) ((((x) + 63) / 32) * 4)
#define IPV6_PREFIX_WORDS(x) (((x) + 63) / 32)
+/* FIXME: these four functions should be significantly redesigned w.r.t. integration,
+ also should be named as ospf3_* instead of *_ipv6_* */
+
static inline u32 *
lsa_get_ipv6_prefix(u32 *buf, ip_addr *addr, int *pxlen, u8 *pxopts, u16 *rest)
{
@@ -787,6 +762,7 @@ lsa_get_ipv6_addr(u32 *buf, ip_addr *addr)
static inline u32 *
put_ipv6_prefix(u32 *buf, ip_addr addr, u8 pxlen, u8 pxopts, u16 lh)
{
+#ifdef IPV6
*buf++ = ((pxlen << 24) | (pxopts << 16) | lh);
if (pxlen > 0)
@@ -797,6 +773,7 @@ put_ipv6_prefix(u32 *buf, ip_addr addr, u8 pxlen, u8 pxopts, u16 lh)
*buf++ = _I2(addr);
if (pxlen > 96)
*buf++ = _I3(addr);
+#endif
return buf;
}
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index 2814712d..a545c7fd 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -265,7 +265,8 @@ ospf_rx_hook(sock *sk, int len)
}
/* Second, we check packet length, checksum, and the protocol version */
- struct ospf_packet *pkt = (struct ospf_packet *) ip_skip_header(sk->rbuf, &len);
+ struct ospf_packet *pkt = (void *) sk_rx_buffer(sk, &len);
+
if (pkt == NULL)
DROP("bad IP header", len);
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index 08f90b49..b616c0d1 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -1822,10 +1822,10 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en,
struct ospf_lsa_link *llsa = lhe->lsa_body;
- if (ipa_zero(llsa->lladdr))
+ if (ip6_zero(llsa->lladdr))
return NULL;
- return new_nexthop(p, llsa->lladdr, pn->iface, pn->weight);
+ return new_nexthop(p, ipa_from_ip6(llsa->lladdr), pn->iface, pn->weight);
}
}
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index 15ba013a..42bf9c45 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -1319,7 +1319,7 @@ prepare_link_lsa_body(struct ospf_proto *p, struct ospf_iface *ifa)
ASSERT(p->lsab_used == 0);
ll = lsab_allocz(p, sizeof(struct ospf_lsa_link));
ll->options = ifa->oa->options | (ifa->priority << 24);
- ll->lladdr = ifa->addr->ip;
+ ll->lladdr = ipa_to_ip6(ifa->addr->ip);
ll = NULL; /* buffer might be reallocated later */
struct ifa *a;