mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-09 18:09:00 +00:00
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.
This commit is contained in:
parent
3c035aa871
commit
62d8e96a06
@ -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>
|
2004-10-31 Paul Jakma <paul@dishone.st>
|
||||||
|
|
||||||
* ospf_packet.c: (ospf_write_frags) Add debug output
|
* ospf_packet.c: (ospf_write_frags) Add debug output
|
||||||
|
@ -485,15 +485,16 @@ ospf_ls_ack_timer (struct thread *thread)
|
|||||||
#ifdef WANT_OSPF_WRITE_FRAGMENT
|
#ifdef WANT_OSPF_WRITE_FRAGMENT
|
||||||
void
|
void
|
||||||
ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
|
ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
|
||||||
struct msghdr *msg, struct iovec *iov[],
|
struct msghdr *msg, unsigned int maxdatasize,
|
||||||
unsigned int maxdatasize,
|
|
||||||
unsigned int mtu, int flags, u_char type)
|
unsigned int mtu, int flags, u_char type)
|
||||||
{
|
{
|
||||||
#define OSPF_WRITE_FRAG_SHIFT 3
|
#define OSPF_WRITE_FRAG_SHIFT 3
|
||||||
u_int16_t offset;
|
u_int16_t offset;
|
||||||
|
struct iovec *iovp;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
assert ( op->length == stream_get_endp(op->s) );
|
assert ( op->length == stream_get_endp(op->s) );
|
||||||
|
assert (msg->msg_iovlen == 2);
|
||||||
|
|
||||||
/* we can but try.
|
/* 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 */
|
/* ip frag offset is expressed in units of 8byte words */
|
||||||
offset = maxdatasize >> OSPF_WRITE_FRAG_SHIFT;
|
offset = maxdatasize >> OSPF_WRITE_FRAG_SHIFT;
|
||||||
|
|
||||||
|
iovp = &msg->msg_iov[1];
|
||||||
|
|
||||||
while ( (stream_get_endp(op->s) - stream_get_getp (op->s))
|
while ( (stream_get_endp(op->s) - stream_get_getp (op->s))
|
||||||
> maxdatasize )
|
> maxdatasize )
|
||||||
{
|
{
|
||||||
/* data length of this frag is to next offset value */
|
/* data length of this frag is to next offset value */
|
||||||
iov[1]->iov_len = offset << OSPF_WRITE_FRAG_SHIFT;
|
iovp->iov_len = offset << OSPF_WRITE_FRAG_SHIFT;
|
||||||
iph->ip_len = iov[1]->iov_len + sizeof (struct ip);
|
iph->ip_len = iovp->iov_len + sizeof (struct ip);
|
||||||
assert (iph->ip_len <= mtu);
|
assert (iph->ip_len <= mtu);
|
||||||
|
|
||||||
sockopt_iphdrincl_swab_htosys (iph);
|
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;
|
iph->ip_off += offset;
|
||||||
stream_forward (op->s, iov[1]->iov_len);
|
stream_forward (op->s, iovp->iov_len);
|
||||||
iov[1]->iov_base = STREAM_PNT (op->s);
|
iovp->iov_base = STREAM_PNT (op->s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup for final fragment */
|
/* setup for final fragment */
|
||||||
iov[1]->iov_len = stream_get_endp(op->s) - stream_get_getp (op->s);
|
iovp->iov_len = stream_get_endp(op->s) - stream_get_getp (op->s);
|
||||||
iph->ip_len = iov[1]->iov_len + sizeof (struct ip);
|
iph->ip_len = iovp->iov_len + sizeof (struct ip);
|
||||||
iph->ip_off &= (~IP_MF);
|
iph->ip_off &= (~IP_MF);
|
||||||
}
|
}
|
||||||
#endif /* WANT_OSPF_WRITE_FRAGMENT */
|
#endif /* WANT_OSPF_WRITE_FRAGMENT */
|
||||||
@ -572,7 +575,7 @@ ospf_write (struct thread *thread)
|
|||||||
struct sockaddr_in sa_dst;
|
struct sockaddr_in sa_dst;
|
||||||
struct ip iph;
|
struct ip iph;
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct iovec iov[2], *iovp;
|
struct iovec iov[2];
|
||||||
u_char type;
|
u_char type;
|
||||||
int ret;
|
int ret;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
@ -676,11 +679,8 @@ ospf_write (struct thread *thread)
|
|||||||
*/
|
*/
|
||||||
#ifdef WANT_OSPF_WRITE_FRAGMENT
|
#ifdef WANT_OSPF_WRITE_FRAGMENT
|
||||||
if ( op->length > maxdatasize )
|
if ( op->length > maxdatasize )
|
||||||
{
|
ospf_write_frags (ospf->fd, op, &iph, &msg, maxdatasize,
|
||||||
iovp = iov;
|
oi->ifp->mtu, flags, type);
|
||||||
ospf_write_frags (ospf->fd, op, &iph, &msg, &iovp, maxdatasize,
|
|
||||||
oi->ifp->mtu, flags, type);
|
|
||||||
}
|
|
||||||
#endif /* WANT_OSPF_WRITE_FRAGMENT */
|
#endif /* WANT_OSPF_WRITE_FRAGMENT */
|
||||||
|
|
||||||
/* send final fragment (could be first) */
|
/* 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."
|
" %d bytes, packet size %ld, dropping it completely."
|
||||||
" OSPF routing is broken!",
|
" OSPF routing is broken!",
|
||||||
inet_ntoa (lsa->data->id), ntohs (lsa->data->length),
|
inet_ntoa (lsa->data->id), ntohs (lsa->data->length),
|
||||||
size);
|
(long int) size);
|
||||||
list_delete_node (update, ln);
|
list_delete_node (update, ln);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user