summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_api.c2
-rw-r--r--ospfd/ospf_apiserver.c18
-rw-r--r--ospfd/ospf_apiserver.h6
-rw-r--r--ospfd/ospf_ase.c6
-rw-r--r--ospfd/ospf_network.c2
-rw-r--r--ospfd/ospf_packet.c16
-rw-r--r--ospfd/ospf_te.c15
7 files changed, 33 insertions, 32 deletions
diff --git a/ospfd/ospf_api.c b/ospfd/ospf_api.c
index 77383191..fc3b51dd 100644
--- a/ospfd/ospf_api.c
+++ b/ospfd/ospf_api.c
@@ -219,7 +219,7 @@ msg_print (struct msg *msg)
#else /* ORIGINAL_CODING */
/* API message common header part. */
zlog_debug
- ("API-msg [%s]: type(%d),len(%d),seq(%lu),data(%p),size(%lu)",
+ ("API-msg [%s]: type(%d),len(%d),seq(%lu),data(%p),size(%zd)",
ospf_api_typename (msg->hdr.msgtype), msg->hdr.msgtype,
ntohs (msg->hdr.msglen), (unsigned long) ntohl (msg->hdr.msgseq),
STREAM_DATA (msg->s), STREAM_SIZE (msg->s));
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index 026ae39a..a964e690 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -38,7 +38,8 @@
#include "log.h"
#include "thread.h"
#include "hash.h"
-#include "sockunion.h" /* for inet_aton() */
+#include "sockunion.h" /* for inet_aton() */
+#include "sockopt.h"
#include "buffer.h"
#include <sys/types.h>
@@ -617,8 +618,7 @@ ospf_apiserver_serv_sock_family (unsigned short port, int family)
int accept_sock;
int rc;
- memset (&su, 0, sizeof (union sockunion));
- su.sa.sa_family = family;
+ sockunion_init_new(&su, family) ;
/* Make new socket */
accept_sock = sockunion_stream_socket (&su);
@@ -626,11 +626,11 @@ ospf_apiserver_serv_sock_family (unsigned short port, int family)
return accept_sock;
/* This is a server, so reuse address and port */
- sockopt_reuseaddr (accept_sock);
- sockopt_reuseport (accept_sock);
+ setsockopt_reuseaddr (accept_sock);
+ setsockopt_reuseport (accept_sock);
/* Bind socket to address and given port. */
- rc = sockunion_bind (accept_sock, &su, port, NULL);
+ rc = sockunion_bind (accept_sock, &su, port, true); /* true => any */
if (rc < 0)
{
close (accept_sock); /* Close socket */
@@ -1831,11 +1831,7 @@ ospf_apiserver_lsa11_originator (void *arg)
/* Periodically refresh opaque LSAs so that they do not expire in
other routers. */
-#if 0
-static void
-#else
extern struct ospf_lsa *
-#endif
ospf_apiserver_lsa_refresher (struct ospf_lsa *lsa)
{
struct ospf_apiserver *apiserv;
@@ -1908,7 +1904,7 @@ ospf_apiserver_lsa_refresher (struct ospf_lsa *lsa)
}
out:
- return NULL;
+ return new;
}
diff --git a/ospfd/ospf_apiserver.h b/ospfd/ospf_apiserver.h
index f1412270..45716d9d 100644
--- a/ospfd/ospf_apiserver.h
+++ b/ospfd/ospf_apiserver.h
@@ -180,11 +180,7 @@ extern void ospf_apiserver_config_write_router (struct vty *vty);
extern void ospf_apiserver_config_write_if (struct vty *vty, struct interface *ifp);
extern void ospf_apiserver_show_info (struct vty *vty, struct ospf_lsa *lsa);
extern int ospf_ospf_apiserver_lsa_originator (void *arg);
-#if 0
-extern void ospf_apiserver_lsa_refresher (struct ospf_lsa *lsa);
-#else
-extern struct ospf_lsa * ospf_apiserver_lsa_refresher (struct ospf_lsa *lsa);
-#endif
+extern struct ospf_lsa *ospf_apiserver_lsa_refresher (struct ospf_lsa *lsa);
extern void ospf_apiserver_flush_opaque_lsa (struct ospf_apiserver *apiserv,
u_char lsa_type, u_char opaque_type);
diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c
index 5bac3448..8ef545c2 100644
--- a/ospfd/ospf_ase.c
+++ b/ospfd/ospf_ase.c
@@ -451,6 +451,8 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
/* if there is a Intra/Inter area route to the N
do not install external route */
if ( (rn = route_node_lookup (ospf->new_table, (struct prefix *) &p)) )
+ if ((rn = route_node_lookup (ospf->new_table,
+ (struct prefix *) &p)))
{
route_unlock_node(rn);
if (rn->info == NULL)
@@ -461,8 +463,8 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
}
/* Find a route to the same dest */
/* If there is no route, create new one. */
- if ( (rn = route_node_lookup (ospf->new_external_route,
- (struct prefix *) &p)) )
+ if ((rn = route_node_lookup (ospf->new_external_route,
+ (struct prefix *) &p)))
route_unlock_node(rn);
if (!rn || (or = rn->info) == NULL)
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index 1e2d44e6..dc06cb61 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -214,7 +214,7 @@ ospf_sock_init (void)
zlog_warn ("IP_HDRINCL option not available");
#endif /* IP_HDRINCL */
- ret = setsockopt_ifindex (AF_INET, ospf_sock, 1);
+ ret = setsockopt_pktinfo (AF_INET, ospf_sock, 1);
if (ret < 0)
zlog_warn ("Can't set pktinfo option for fd %d", ospf_sock);
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 242a2081..23eae565 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -687,6 +687,13 @@ ospf_write (struct thread *thread)
iph.ip_tos = IPTOS_PREC_INTERNETCONTROL;
iph.ip_len = (iph.ip_hl << OSPF_WRITE_IPHL_SHIFT) + op->length;
+#if defined(__DragonFly__)
+ /*
+ * DragonFly's raw socket expects ip_len/ip_off in network byte order.
+ */
+ iph.ip_len = htons(iph.ip_len);
+#endif
+
#ifdef WANT_OSPF_WRITE_FRAGMENT
/* XXX-MT: not thread-safe at all..
* XXX: this presumes this is only programme sending OSPF packets
@@ -2126,6 +2133,15 @@ ospf_recv_packet (int fd, struct interface **ifp, struct stream *ibuf)
ip_len = ip_len + (iph->ip_hl << 2);
#endif
+#if defined(__DragonFly__)
+ /*
+ * in DragonFly's raw socket, ip_len/ip_off are read
+ * in network byte order.
+ * As OpenBSD < 200311 adjust ip_len to strip IP header size!
+ */
+ ip_len = ntohs(iph->ip_len) + (iph->ip_hl << 2);
+#endif
+
ifindex = getsockopt_ifindex (AF_INET, &msgh);
*ifp = if_lookup_by_index (ifindex);
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index 3467ad71..5970a51f 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -133,13 +133,7 @@ static void ospf_mpls_te_config_write_router (struct vty *vty);
static void ospf_mpls_te_config_write_if (struct vty *vty, struct interface *ifp);
static void ospf_mpls_te_show_info (struct vty *vty, struct ospf_lsa *lsa);
static int ospf_mpls_te_lsa_originate (void *arg);
-
-#if 0
-static void ospf_mpls_te_lsa_refresh (struct ospf_lsa *lsa);
-#else
-static struct ospf_lsa * ospf_mpls_te_lsa_refresh (struct ospf_lsa *lsa);
-#endif
-
+static struct ospf_lsa *ospf_mpls_te_lsa_refresh (struct ospf_lsa *lsa);
static void ospf_mpls_te_lsa_schedule (struct mpls_te_link *lp, enum sched_opcode);
static void del_mpls_te_link (void *val);
@@ -1014,11 +1008,8 @@ ospf_mpls_te_lsa_originate (void *arg)
out:
return rc;
}
-#if 0
-static void
-#else
+
static struct ospf_lsa *
-#endif
ospf_mpls_te_lsa_refresh (struct ospf_lsa *lsa)
{
struct mpls_te_link *lp;
@@ -1079,7 +1070,7 @@ ospf_mpls_te_lsa_refresh (struct ospf_lsa *lsa)
}
out:
- return NULL;
+ return new;
}
static void