summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog5
-rw-r--r--lib/sockopt.c29
-rw-r--r--lib/sockopt.h2
3 files changed, 36 insertions, 0 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 55ddfff8..26a25171 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-21 Denis Ovsienko
+
+ * sockopt.[ch]: (setsockopt_so_sendbuf, getsockopt_so_sendbuf):
+ new functions to adjust ospfd working socket.
+
2007-08-13 Denis Ovsienko
* zebra.h: introduce ZEBRA_ERR_KERNEL and ZEBRA_ERR_NOERROR
diff --git a/lib/sockopt.c b/lib/sockopt.c
index f5f1a7ed..f8fa946e 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -36,6 +36,35 @@ setsockopt_so_recvbuf (int sock, int size)
return ret;
}
+int
+setsockopt_so_sendbuf (const int sock, int size)
+{
+ int ret = setsockopt (sock, SOL_SOCKET, SO_SNDBUF,
+ (char *)&size, sizeof (int));
+
+ if (ret < 0)
+ zlog_err ("fd %d: can't setsockopt SO_SNDBUF to %d: %s",
+ sock, size, safe_strerror (errno));
+
+ return ret;
+}
+
+int
+getsockopt_so_sendbuf (const int sock)
+{
+ u_int32_t optval;
+ socklen_t optlen = sizeof (optval);
+ int ret = getsockopt (sock, SOL_SOCKET, SO_SNDBUF,
+ (char *)&optval, &optlen);
+ if (ret < 0)
+ {
+ zlog_err ("fd %d: can't getsockopt SO_SNDBUF: %d (%s)",
+ sock, errno, safe_strerror (errno));
+ return ret;
+ }
+ return optval;
+}
+
static void *
getsockopt_cmsg_data (struct msghdr *msgh, int level, int type)
{
diff --git a/lib/sockopt.h b/lib/sockopt.h
index 65ba34f1..ebb71430 100644
--- a/lib/sockopt.h
+++ b/lib/sockopt.h
@@ -23,6 +23,8 @@
#define _ZEBRA_SOCKOPT_H
extern int setsockopt_so_recvbuf (int sock, int size);
+extern int setsockopt_so_sendbuf (const int sock, int size);
+extern int getsockopt_so_sendbuf (const int sock);
#ifdef HAVE_IPV6
extern int setsockopt_ipv6_pktinfo (int, int);