View | Details | Raw Unified | Return to bug 4
Collapse All | Expand All

(-)a/netlink.c (-6 / +9 lines)
Lines 34-39 Link Here
34
#include "log.h"
34
#include "log.h"
35
#include "netlink.h"
35
#include "netlink.h"
36
36
37
#define NLBUFSIZ	(8192 * sizeof(struct nlmsghdr)) /* See netlink(7) */
38
37
/* Socket in init, in target namespace, sequence (just needs to be monotonic) */
39
/* Socket in init, in target namespace, sequence (just needs to be monotonic) */
38
static int nl_sock	= -1;
40
static int nl_sock	= -1;
39
static int nl_sock_ns	= -1;
41
static int nl_sock_ns	= -1;
Lines 105-111 fail: Link Here
105
static int nl_req(int ns, char *buf, const void *req, ssize_t len)
107
static int nl_req(int ns, char *buf, const void *req, ssize_t len)
106
{
108
{
107
	int s = ns ? nl_sock_ns : nl_sock, done = 0;
109
	int s = ns ? nl_sock_ns : nl_sock, done = 0;
108
	char flush[BUFSIZ];
110
	char flush[NLBUFSIZ];
109
	ssize_t n;
111
	ssize_t n;
110
112
111
	while (!done && (n = recv(s, flush, sizeof(flush), MSG_DONTWAIT)) > 0) {
113
	while (!done && (n = recv(s, flush, sizeof(flush), MSG_DONTWAIT)) > 0) {
Lines 121-127 static int nl_req(int ns, char *buf, const void *req, ssize_t len) Link Here
121
		}
123
		}
122
	}
124
	}
123
125
124
	if ((send(s, req, len, 0) < len) || (len = recv(s, buf, BUFSIZ, 0)) < 0)
126
	if ((send(s, req, len, 0) < len) ||
127
	    (len = recv(s, buf, NLBUFSIZ, 0)) < 0)
125
		return -errno;
128
		return -errno;
126
129
127
	return len;
130
	return len;
Lines 149-155 unsigned int nl_get_ext_if(sa_family_t af) Link Here
149
	};
152
	};
150
	struct nlmsghdr *nh;
153
	struct nlmsghdr *nh;
151
	struct rtattr *rta;
154
	struct rtattr *rta;
152
	char buf[BUFSIZ];
155
	char buf[NLBUFSIZ];
153
	ssize_t n;
156
	ssize_t n;
154
	size_t na;
157
	size_t na;
155
158
Lines 227-233 void nl_route(int ns, unsigned int ifi, sa_family_t af, void *gw) Link Here
227
	struct nlmsghdr *nh;
230
	struct nlmsghdr *nh;
228
	struct rtattr *rta;
231
	struct rtattr *rta;
229
	struct rtmsg *rtm;
232
	struct rtmsg *rtm;
230
	char buf[BUFSIZ];
233
	char buf[NLBUFSIZ];
231
	ssize_t n;
234
	ssize_t n;
232
	size_t na;
235
	size_t na;
233
236
Lines 336-342 void nl_addr(int ns, unsigned int ifi, sa_family_t af, Link Here
336
	struct ifaddrmsg *ifa;
339
	struct ifaddrmsg *ifa;
337
	struct nlmsghdr *nh;
340
	struct nlmsghdr *nh;
338
	struct rtattr *rta;
341
	struct rtattr *rta;
339
	char buf[BUFSIZ];
342
	char buf[NLBUFSIZ];
340
	ssize_t n;
343
	ssize_t n;
341
	size_t na;
344
	size_t na;
342
345
Lines 446-452 void nl_link(int ns, unsigned int ifi, void *mac, int up, int mtu) Link Here
446
	struct ifinfomsg *ifm;
449
	struct ifinfomsg *ifm;
447
	struct nlmsghdr *nh;
450
	struct nlmsghdr *nh;
448
	struct rtattr *rta;
451
	struct rtattr *rta;
449
	char buf[BUFSIZ];
452
	char buf[NLBUFSIZ];
450
	ssize_t n;
453
	ssize_t n;
451
	size_t na;
454
	size_t na;
452
455

Return to bug 4