mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 09:52:27 +00:00
2004-10-05 Paul Jakma <paul@dishone.st>
* ospf_packet.c: replace ospf_swap_iph_to... with sockopt_iphdrincl_swab_...
This commit is contained in:
parent
96e27c9928
commit
18b12c387e
@ -1,3 +1,8 @@
|
|||||||
|
2004-10-05 Paul Jakma <paul@dishone.st>
|
||||||
|
|
||||||
|
* ospf_packet.c: replace ospf_swap_iph_to... with
|
||||||
|
sockopt_iphdrincl_swab_...
|
||||||
|
|
||||||
2004-10-03 James R. Leu <jleu at mindspring.com>
|
2004-10-03 James R. Leu <jleu at mindspring.com>
|
||||||
|
|
||||||
* ospf_zebra.c: Read router id related messages from zebra daemon.
|
* ospf_zebra.c: Read router id related messages from zebra daemon.
|
||||||
|
@ -607,13 +607,7 @@ ospf_ip_header_dump (struct stream *s)
|
|||||||
|
|
||||||
iph = (struct ip *) STREAM_PNT (s);
|
iph = (struct ip *) STREAM_PNT (s);
|
||||||
|
|
||||||
#ifdef HAVE_IP_HDRINCL_BSD_ORDER
|
sockopt_iphdrincl_swab_systoh (iph);
|
||||||
length = iph->ip_len;
|
|
||||||
offset = iph->ip_off;
|
|
||||||
#else /* !HAVE_IP_HDRINCL_BSD_ORDER */
|
|
||||||
length = ntohs (iph->ip_len);
|
|
||||||
offset = ntohs (iph->ip_off);
|
|
||||||
#endif /* HAVE_IP_HDRINCL_BSD_ORDER */
|
|
||||||
|
|
||||||
/* IP Header dump. */
|
/* IP Header dump. */
|
||||||
zlog_info ("ip_v %d", iph->ip_v);
|
zlog_info ("ip_v %d", iph->ip_v);
|
||||||
|
@ -482,33 +482,6 @@ ospf_ls_ack_timer (struct thread *thread)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* swab ip header fields to required order for sendmsg */
|
|
||||||
void
|
|
||||||
ospf_swab_iph_ton (struct ip *iph)
|
|
||||||
{
|
|
||||||
/* BSD and derived take iph in network order, except for
|
|
||||||
* ip_len and ip_off
|
|
||||||
*/
|
|
||||||
#ifndef HAVE_IP_HDRINCL_BSD_ORDER
|
|
||||||
iph->ip_len = htons(iph->ip_len);
|
|
||||||
iph->ip_off = htons(iph->ip_off);
|
|
||||||
#endif /* HAVE_IP_HDRINCL_BSD_ORDER */
|
|
||||||
|
|
||||||
iph->ip_id = htons(iph->ip_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* swab ip header fields to host order, as required */
|
|
||||||
void
|
|
||||||
ospf_swab_iph_toh (struct ip *iph)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_IP_HDRINCL_BSD_ORDER
|
|
||||||
iph->ip_len = ntohs(iph->ip_len);
|
|
||||||
iph->ip_off = ntohs(iph->ip_off);
|
|
||||||
#endif /* HAVE_IP_HDRINCL_BSD_ORDER */
|
|
||||||
|
|
||||||
iph->ip_id = ntohs(iph->ip_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
#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,
|
||||||
@ -549,11 +522,11 @@ ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
|
|||||||
iph->ip_len = iov[1]->iov_len + sizeof (struct ip);
|
iph->ip_len = iov[1]->iov_len + sizeof (struct ip);
|
||||||
assert (iph->ip_len <= mtu);
|
assert (iph->ip_len <= mtu);
|
||||||
|
|
||||||
ospf_swab_iph_ton (iph);
|
sockopt_iphdrincl_swab_htosys (iph);
|
||||||
|
|
||||||
ret = sendmsg (fd, msg, flags);
|
ret = sendmsg (fd, msg, flags);
|
||||||
|
|
||||||
ospf_swab_iph_toh (iph);
|
sockopt_iphdrincl_swab_systoh (iph);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
zlog_warn ("*** sendmsg in ospf_write to %s,"
|
zlog_warn ("*** sendmsg in ospf_write to %s,"
|
||||||
@ -692,9 +665,9 @@ ospf_write (struct thread *thread)
|
|||||||
#endif /* WANT_OSPF_WRITE_FRAGMENT */
|
#endif /* WANT_OSPF_WRITE_FRAGMENT */
|
||||||
|
|
||||||
/* send final fragment (could be first) */
|
/* send final fragment (could be first) */
|
||||||
ospf_swab_iph_ton (&iph);
|
sockopt_iphdrincl_swab_htosys (&iph);
|
||||||
ret = sendmsg (ospf->fd, &msg, flags);
|
ret = sendmsg (ospf->fd, &msg, flags);
|
||||||
ospf_swab_iph_toh (&iph);
|
sockopt_iphdrincl_swab_htosys (&iph);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
zlog_warn ("*** sendmsg in ospf_write to %s failed with %s",
|
zlog_warn ("*** sendmsg in ospf_write to %s failed with %s",
|
||||||
@ -2041,11 +2014,7 @@ ospf_recv_packet (int fd, struct interface **ifp)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_IP_HDRINCL_BSD_ORDER
|
sockopt_iphdrincl_swab_systoh (&iph);
|
||||||
ip_len = iph.ip_len;
|
|
||||||
#else
|
|
||||||
ip_len = ntohs (iph.ip_len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(GNU_LINUX) && (OpenBSD < 200311)
|
#if !defined(GNU_LINUX) && (OpenBSD < 200311)
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user