#include "netlink-protocol.h"
#include "ofpbuf.h"
#include "poll-loop.h"
+#include "stress.h"
#include "timeval.h"
#include "util.h"
#include "vlog.h"
return error;
}
+/* This stress option is useful for testing that OVS properly tolerates
+ * -ENOBUFS on NetLink sockets. Such errors are unavoidable because they can
+ * occur if the kernel cannot temporarily allocate enough GFP_ATOMIC memory to
+ * reply to a request. They can also occur if messages arrive on a multicast
+ * channel faster than OVS can process them. */
+STRESS_OPTION(
+ netlink_overflow, "simulate netlink socket receive buffer overflow",
+ 5, 1, -1, 100);
+
/* Tries to receive a netlink message from the kernel on 'sock'. If
* successful, stores the received message into '*bufp' and returns 0. The
* caller is responsible for destroying the message with ofpbuf_delete(). On
ofpbuf_delete(buf);
return EPROTO;
}
+
+ if (STRESS(netlink_overflow)) {
+ ofpbuf_delete(buf);
+ return ENOBUFS;
+ }
+
*bufp = buf;
log_nlmsg(__func__, 0, buf->data, buf->size);
COVERAGE_INC(netlink_received);
+
return 0;
}