summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospfd/ChangeLog10
-rw-r--r--ospfd/ospf_packet.c30
2 files changed, 25 insertions, 15 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index d174337a..e3efeb10 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,13 @@
+2004-11-02 Paul Jakma <paul@dishone.st>
+
+ * ospf_packet.c: (ospf_write_frags) remove iov arg, msg already points
+ to it. Add convenience pointer to msg->msg_iov[1], and use this,
+ fixing the unfortunate borkenness introduced in moving of this code
+ to a function.
+ (ospf_write) remove iovp and fix up call to previous.
+ (ospf_ls_upd_packet_new) cast size to long int - unfortunately
+ glibc's size_t format modifier is not portable.
+
2004-10-31 Paul Jakma <paul@dishone.st>
* ospf_packet.c: (ospf_write_frags) Add debug output
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 2664b4ea..5a1c0916 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -485,15 +485,16 @@ ospf_ls_ack_timer (struct thread *thread)
#ifdef WANT_OSPF_WRITE_FRAGMENT
void
ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
- struct msghdr *msg, struct iovec *iov[],
- unsigned int maxdatasize,
+ struct msghdr *msg, unsigned int maxdatasize,
unsigned int mtu, int flags, u_char type)
{
#define OSPF_WRITE_FRAG_SHIFT 3
u_int16_t offset;
+ struct iovec *iovp;
int ret;
assert ( op->length == stream_get_endp(op->s) );
+ assert (msg->msg_iovlen == 2);
/* we can but try.
*
@@ -515,12 +516,14 @@ ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
/* ip frag offset is expressed in units of 8byte words */
offset = maxdatasize >> OSPF_WRITE_FRAG_SHIFT;
+ iovp = &msg->msg_iov[1];
+
while ( (stream_get_endp(op->s) - stream_get_getp (op->s))
> maxdatasize )
{
/* data length of this frag is to next offset value */
- iov[1]->iov_len = offset << OSPF_WRITE_FRAG_SHIFT;
- iph->ip_len = iov[1]->iov_len + sizeof (struct ip);
+ iovp->iov_len = offset << OSPF_WRITE_FRAG_SHIFT;
+ iph->ip_len = iovp->iov_len + sizeof (struct ip);
assert (iph->ip_len <= mtu);
sockopt_iphdrincl_swab_htosys (iph);
@@ -552,13 +555,13 @@ ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
}
iph->ip_off += offset;
- stream_forward (op->s, iov[1]->iov_len);
- iov[1]->iov_base = STREAM_PNT (op->s);
+ stream_forward (op->s, iovp->iov_len);
+ iovp->iov_base = STREAM_PNT (op->s);
}
/* setup for final fragment */
- iov[1]->iov_len = stream_get_endp(op->s) - stream_get_getp (op->s);
- iph->ip_len = iov[1]->iov_len + sizeof (struct ip);
+ iovp->iov_len = stream_get_endp(op->s) - stream_get_getp (op->s);
+ iph->ip_len = iovp->iov_len + sizeof (struct ip);
iph->ip_off &= (~IP_MF);
}
#endif /* WANT_OSPF_WRITE_FRAGMENT */
@@ -572,7 +575,7 @@ ospf_write (struct thread *thread)
struct sockaddr_in sa_dst;
struct ip iph;
struct msghdr msg;
- struct iovec iov[2], *iovp;
+ struct iovec iov[2];
u_char type;
int ret;
int flags = 0;
@@ -676,11 +679,8 @@ ospf_write (struct thread *thread)
*/
#ifdef WANT_OSPF_WRITE_FRAGMENT
if ( op->length > maxdatasize )
- {
- iovp = iov;
- ospf_write_frags (ospf->fd, op, &iph, &msg, &iovp, maxdatasize,
- oi->ifp->mtu, flags, type);
- }
+ ospf_write_frags (ospf->fd, op, &iph, &msg, maxdatasize,
+ oi->ifp->mtu, flags, type);
#endif /* WANT_OSPF_WRITE_FRAGMENT */
/* send final fragment (could be first) */
@@ -3249,7 +3249,7 @@ ospf_ls_upd_packet_new (struct list *update, struct ospf_interface *oi)
" %d bytes, packet size %ld, dropping it completely."
" OSPF routing is broken!",
inet_ntoa (lsa->data->id), ntohs (lsa->data->length),
- size);
+ (long int) size);
list_delete_node (update, ln);
return NULL;
}