Commit 4d565e26 authored by Robert Ricci's avatar Robert Ricci
Browse files

Add support for reporting if the application changes a few sockopts:

SO_RCVSIZE
SO_SNDSIZE
TCP_NODELAY
TCP_MAXSEG

There is a problem, though. Right now, we identify a connection by a
triple of (local port, remote IP, remote port). However, some apps
(iperf, at least), set these options before calling connect(). Thus,
we don't know these things yet. To fix this, we could either:
  Delay notification of sockopt changes until after connect() is
    called for the socket
  Use something else (ie. (pid,fd)) as the ID for connections.
We should probably talk about this (at least Jon and I) at the
next meeting.
parent 841e95a2
......@@ -770,6 +770,37 @@ int setsockopt (int s, int level, int optname, const void *optval,
printf("Warning: Capped attempt to change SO_SNDBUF or SO_RCVBUF\n");
*((int *)optval) = max_bufsize;
}
/*
* Let the monitor know that the app has changed it socket buffer size
*/
if (output_version == 2) {
fprintf(outstream,"%s: ", (optname == SO_SNDBUF) ?
"SO_SNDBUF" : "SO_RCVBUF");
fprintID(outstream,s);
fprintf(outstream," %i\n", *((int *)optval));
}
}
/*
* There are some TCP options we have to watch for
* TODO: Check for success before reporting
*/
if (level == IPPROTO_TCP) {
if (optname == TCP_NODELAY) {
if (output_version == 2) {
fprintf(outstream,"TCP_NODELAY: ");
fprintID(outstream,s);
fprintf(outstream," %i\n",*((int *)optval));
}
}
if (optname == TCP_MAXSEG) {
if (output_version == 2) {
fprintf(outstream,"TCP_MAXSEG: ");
fprintID(outstream,s);
fprintf(outstream," %i\n",*((int *)optval));
}
}
}
/*
......@@ -819,7 +850,7 @@ ssize_t recv(int s, void *buf, size_t len, int flags) {
}
/*
* See comment for recvmsg()
* See comment for read()
*/
ssize_t recvmsg(int s, struct msghdr *msg, int flags) {
ssize_t rv;
......
......@@ -25,6 +25,7 @@
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <unistd.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment