From b7fe4141123c6fc26fffec68d0db62ecf474c074 Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Tue, 21 Aug 2007 16:32:56 +0000 Subject: Bug #362 is fixed now. --- ospfd/ospf_network.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'ospfd/ospf_network.c') diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index e8c98371..11155dbc 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -41,6 +41,7 @@ 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" @@ -233,3 +234,37 @@ ospf_sock_init (void) return ospf_sock; } + +void +ospf_adjust_sndbuflen (struct ospf * ospf, 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 + * (OSPF_SNDBUFLEN_DEFAULT initially, which seems to be a sane + * default; or the MTU of a newly added interface). However, + * if the OS has truncated the actual buffer size to somewhat + * less or bigger size, try to detect it and update our records + * appropriately. + */ + ret = setsockopt_so_sendbuf (ospf->fd, buflen); + newbuflen = getsockopt_so_sendbuf (ospf->fd); + if (ret < 0 || newbuflen != buflen) + zlog_warn ("%s: tried to set SO_SNDBUF to %d, but got %d", + __func__, buflen, newbuflen); + if (newbuflen >= 0) + ospf->maxsndbuflen = 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)); +} -- cgit v1.2.3 From f102e75f613af740241dfa7253a2362c7935b9a8 Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Tue, 18 Sep 2007 09:01:13 +0000 Subject: + fix minor regression in OSPF sending buffer adjustment logic --- ospfd/ospf_network.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ospfd/ospf_network.c') diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index 11155dbc..d5bf7493 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -249,15 +249,15 @@ ospf_adjust_sndbuflen (struct ospf * ospf, int buflen) 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 - * (OSPF_SNDBUFLEN_DEFAULT initially, which seems to be a sane - * default; or the MTU of a newly added interface). However, - * if the OS has truncated the actual buffer size to somewhat - * less or bigger size, try to detect it and update our records - * appropriately. + * (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 != buflen) + if (ret < 0 || newbuflen < buflen) zlog_warn ("%s: tried to set SO_SNDBUF to %d, but got %d", __func__, buflen, newbuflen); if (newbuflen >= 0) -- cgit v1.2.3 From 1423c809cc4ddc2e013ba6264c49a11e5719c6f2 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 14 Aug 2008 17:59:25 +0100 Subject: [lib] mes_lookup string lookup table argument should be marked const 2008-08-14 Stephen Hemminger * lib/log.{c,h}: struct message argument should point to const * */*.c: adjust to suit, Signed-off-by: Paul Jakma --- ospfd/ospf_network.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'ospfd/ospf_network.c') diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index d5bf7493..89ff2038 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -165,11 +165,7 @@ int ospf_sock_init (void) { int ospf_sock; - /* - * XXX warning: unused variable `tos' - * tos should be ifdefed similarly to usage - */ - int ret, tos, hincl = 1; + int ret, hincl = 1; if ( ospfd_privs.change (ZPRIVS_RAISE) ) zlog_err ("ospf_sock_init: could not raise privs, %s", @@ -201,10 +197,7 @@ ospf_sock_init (void) #elif defined (IPTOS_PREC_INTERNETCONTROL) #warning "IP_HDRINCL not available on this system" #warning "using IPTOS_PREC_INTERNETCONTROL" - /* Set precedence field. */ - tos = IPTOS_PREC_INTERNETCONTROL; - ret = setsockopt (ospf_sock, IPPROTO_IP, IP_TOS, - (char *) &tos, sizeof (int)); + ret = setsockopt_ipv4_tos(ospf_sock, IPTOS_PREC_INTERNETCONTROL); if (ret < 0) { int save_errno = errno; -- cgit v1.2.3