summaryrefslogtreecommitdiff
path: root/ospfd/ospf_packet.c
diff options
context:
space:
mode:
authorPaul Jakma <paul@quagga.net>2011-07-29 18:21:50 +0100
committerPaul Jakma <paul@quagga.net>2011-07-29 18:21:50 +0100
commit538cb284864c17de66152a5236db4cd80e3e7639 (patch)
treed74ad1f719ca611e13bef19aea129f0653551fff /ospfd/ospf_packet.c
parent036a6e6cf63a1046ab260d090719b305069288eb (diff)
parent8ced4e82e6f417b13f4bfc09018fc51fd31058e2 (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'ospfd/ospf_packet.c')
-rw-r--r--ospfd/ospf_packet.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 8b7c63a9..be137d91 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -688,6 +688,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
@@ -2127,6 +2134,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);