mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 23:52:18 +00:00
ospfd: set the OSPF socket's send buffer size only once
This reverts commitb7fe4141
, which introduced a logic where the OSPF send buffer size was dynamically updated to reflect the maximum MTU of the OSPF enabled interfaces (this was done to make ospfd work with interfaces configured for jumbo frames). Since commita78d75b0
, this is not necessary anymore because ospf_sock_init() now sets the OSPF send buffer size to a very high value (8MB). Also, the previous logic was broken because it didn't account for run-time interface MTU changes. Signed-off-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
4743c4e4df
commit
de587d745e
@ -797,11 +797,6 @@ ospf_if_up (struct ospf_interface *oi)
|
||||
OSPF_ISM_EVENT_SCHEDULE (oi, ISM_LoopInd);
|
||||
else
|
||||
{
|
||||
struct ospf *ospf = ospf_lookup ();
|
||||
if (ospf != NULL)
|
||||
ospf_adjust_sndbuflen (ospf, oi->ifp->mtu);
|
||||
else
|
||||
zlog_warn ("%s: ospf_lookup() returned NULL", __func__);
|
||||
ospf_if_stream_set (oi);
|
||||
OSPF_ISM_EVENT_SCHEDULE (oi, ISM_InterfaceUp);
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ extern struct zebra_privs_t ospfd_privs;
|
||||
#include "ospfd/ospf_lsdb.h"
|
||||
#include "ospfd/ospf_neighbor.h"
|
||||
#include "ospfd/ospf_packet.h"
|
||||
#include "ospfd/ospf_dump.h"
|
||||
|
||||
|
||||
|
||||
@ -258,37 +257,3 @@ ospf_sock_init (void)
|
||||
|
||||
return ospf_sock;
|
||||
}
|
||||
|
||||
void
|
||||
ospf_adjust_sndbuflen (struct ospf * ospf, unsigned int buflen)
|
||||
{
|
||||
int ret, newbuflen;
|
||||
/* Check if any work has to be done at all. */
|
||||
if (ospf->maxsndbuflen >= buflen)
|
||||
return;
|
||||
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
|
||||
zlog_debug ("%s: adjusting OSPF send buffer size to %d",
|
||||
__func__, buflen);
|
||||
if (ospfd_privs.change (ZPRIVS_RAISE))
|
||||
zlog_err ("%s: could not raise privs, %s", __func__,
|
||||
safe_strerror (errno));
|
||||
/* Now we try to set SO_SNDBUF to what our caller has requested
|
||||
* (the MTU of a newly added interface). However, if the OS has
|
||||
* truncated the actual buffer size to somewhat less size, try
|
||||
* to detect it and update our records appropriately. The OS
|
||||
* may allocate more buffer space, than requested, this isn't
|
||||
* a error.
|
||||
*/
|
||||
ret = setsockopt_so_sendbuf (ospf->fd, buflen);
|
||||
newbuflen = getsockopt_so_sendbuf (ospf->fd);
|
||||
if (ret < 0 || newbuflen < 0 || newbuflen < (int) buflen)
|
||||
zlog_warn ("%s: tried to set SO_SNDBUF to %u, but got %d",
|
||||
__func__, buflen, newbuflen);
|
||||
if (newbuflen >= 0)
|
||||
ospf->maxsndbuflen = (unsigned int)newbuflen;
|
||||
else
|
||||
zlog_warn ("%s: failed to get SO_SNDBUF", __func__);
|
||||
if (ospfd_privs.change (ZPRIVS_LOWER))
|
||||
zlog_err ("%s: could not lower privs, %s", __func__,
|
||||
safe_strerror (errno));
|
||||
}
|
||||
|
@ -34,6 +34,5 @@ extern int ospf_if_drop_alldrouters (struct ospf *, struct prefix *,
|
||||
ifindex_t);
|
||||
extern int ospf_if_ipmulticast (struct ospf *, struct prefix *, ifindex_t);
|
||||
extern int ospf_sock_init (void);
|
||||
extern void ospf_adjust_sndbuflen (struct ospf *, unsigned int);
|
||||
|
||||
#endif /* _ZEBRA_OSPF_NETWORK_H */
|
||||
|
@ -691,13 +691,9 @@ ospf_write (struct thread *thread)
|
||||
last_serviced_oi = oi;
|
||||
}
|
||||
pkt_count++;
|
||||
/* convenience - max OSPF data per packet,
|
||||
* and reliability - not more data, than our
|
||||
* socket can accept
|
||||
*/
|
||||
#ifdef WANT_OSPF_WRITE_FRAGMENT
|
||||
maxdatasize = MIN (oi->ifp->mtu, ospf->maxsndbuflen) -
|
||||
sizeof (struct ip);
|
||||
/* convenience - max OSPF data per packet */
|
||||
maxdatasize = oi->ifp->mtu - sizeof (struct ip);
|
||||
#endif /* WANT_OSPF_WRITE_FRAGMENT */
|
||||
/* Get one packet from queue. */
|
||||
op = ospf_fifo_head (oi->obuf);
|
||||
|
@ -280,10 +280,6 @@ ospf_new (u_short instance)
|
||||
"a socket");
|
||||
exit(1);
|
||||
}
|
||||
new->maxsndbuflen = getsockopt_so_sendbuf (new->fd);
|
||||
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
|
||||
zlog_debug ("%s: starting with OSPF send buffer size %u",
|
||||
__func__, new->maxsndbuflen);
|
||||
if ((new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE+1)) == NULL)
|
||||
{
|
||||
zlog_err("ospf_new: fatal error: stream_new(%u) failed allocating ibuf",
|
||||
|
@ -252,7 +252,6 @@ struct ospf
|
||||
int write_oi_count; /* Num of packets sent per thread invocation */
|
||||
struct thread *t_read;
|
||||
int fd;
|
||||
unsigned int maxsndbuflen;
|
||||
struct stream *ibuf;
|
||||
struct list *oi_write_q;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user