Skip to content

Commit 1702682

Browse files
authored
Merge pull request #58 from samuelemusiani/master
fix: connecting to a non-existing port on switch returns error
2 parents e361f04 + f16d23a commit 1702682

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/vde_switch/datasock.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,19 +259,24 @@ static void handle_io(unsigned char type,int fd,int revents,void *arg)
259259
if (ep != NULL) {
260260
mainloop_set_private_data(fd,ep);
261261
setup_description(ep,strdup(req->v3.description));
262+
} else {
263+
remove_fd(fd);
264+
return;
262265
}
263266
}
264267
else if(req->v3.version > 2 || req->v3.version == 2) {
265268
printlog(LOG_ERR, "Request for a version %d port, which this "
266269
"vde_switch doesn't support", req->v3.version);
267-
remove_fd(fd);
268-
}
269-
else {
270+
remove_fd(fd);
271+
} else {
270272
memcpy(&sa_un, &req->v1.u.new_control.name, sizeof(struct sockaddr_un));
271273
ep=new_port_v1_v3(fd, req->v1.type, &sa_un);
272274
if (ep != NULL) {
273275
mainloop_set_private_data(fd,ep);
274276
setup_description(ep,strdup(req->v1.description));
277+
} else {
278+
remove_fd(fd);
279+
return;
275280
}
276281
}
277282
}

0 commit comments

Comments
 (0)