Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Vhost-User: Fix bind sockaddr length
[vpp.git]
/
vnet
/
vnet
/
devices
/
dpdk
/
vhost_user.c
diff --git
a/vnet/vnet/devices/dpdk/vhost_user.c
b/vnet/vnet/devices/dpdk/vhost_user.c
index
212313a
..
0df9f0b
100644
(file)
--- a/
vnet/vnet/devices/dpdk/vhost_user.c
+++ b/
vnet/vnet/devices/dpdk/vhost_user.c
@@
-1353,8
+1353,8
@@
static clib_error_t * dpdk_vhost_user_socksvr_accept_ready (unix_file_t * uf)
// init server socket on specified sock_filename
static int dpdk_vhost_user_init_server_sock(const char * sock_filename, int *sockfd)
{
// init server socket on specified sock_filename
static int dpdk_vhost_user_init_server_sock(const char * sock_filename, int *sockfd)
{
- int rv = 0
, len
;
- struct sockaddr_un un;
+ int rv = 0;
+ struct sockaddr_un un
= {}
;
int fd;
/* create listening socket */
fd = socket(AF_UNIX, SOCK_STREAM, 0);
int fd;
/* create listening socket */
fd = socket(AF_UNIX, SOCK_STREAM, 0);
@@
-1369,9
+1369,7
@@
static int dpdk_vhost_user_init_server_sock(const char * sock_filename, int *soc
/* remove if exists */
unlink( (char *) sock_filename);
/* remove if exists */
unlink( (char *) sock_filename);
- len = strlen((char *) un.sun_path) + strlen((char *) sock_filename);
-
- if (bind(fd, (struct sockaddr *) &un, len) == -1) {
+ if (bind(fd, (struct sockaddr *) &un, sizeof(un)) == -1) {
rv = VNET_API_ERROR_SYSCALL_ERROR_2;
goto error;
}
rv = VNET_API_ERROR_SYSCALL_ERROR_2;
goto error;
}