X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvcl%2Fvcom.c;h=82c65e854e038b6a179fe05bad4dd72cc10b3ca7;hb=c04cbf16ccfd9ef142937e4684af6093d812a866;hp=7c163112ba124b48346e8be7cbfba660d33637b0;hpb=048b1d6ab787e46ad91574ac950329bccc7fe809;p=vpp.git diff --git a/src/vcl/vcom.c b/src/vcl/vcom.c index 7c163112ba1..82c65e854e0 100644 --- a/src/vcl/vcom.c +++ b/src/vcl/vcom.c @@ -371,7 +371,7 @@ readv (int fd, const struct iovec * iov, int iovcnt) const char *func_str; ssize_t size = 0; u32 sid = vcom_sid_from_fd (fd); - int rv, i, total = 0; + int rv = 0, i, total = 0; if ((errno = -vcom_init ())) return -1; @@ -508,7 +508,7 @@ writev (int fd, const struct iovec * iov, int iovcnt) const char *func_str; ssize_t size = 0, total = 0; u32 sid = vcom_sid_from_fd (fd); - int rv, i; + int i, rv = 0; /* * Use [f]printf() instead of clib_warning() to prevent recursion SIGSEGV. @@ -1142,19 +1142,18 @@ socket (int domain, int type, int protocol) ((sock_type == SOCK_STREAM) || (sock_type == SOCK_DGRAM))) { int sid; - u32 vrf = VPPCOM_VRF_DEFAULT; u8 proto = ((sock_type == SOCK_DGRAM) ? VPPCOM_PROTO_UDP : VPPCOM_PROTO_TCP); func_str = "vppcom_session_create"; if (VCOM_DEBUG > 0) - clib_warning ("LDP<%d>: : calling %s(): vrf %u, " + clib_warning ("LDP<%d>: : calling %s(): " "proto %u (%s), is_nonblocking %u", - getpid (), func_str, vrf, proto, + getpid (), func_str, proto, vppcom_proto_str (proto), is_nonblocking); - sid = vppcom_session_create (vrf, proto, is_nonblocking); + sid = vppcom_session_create (proto, is_nonblocking); if (sid < 0) { errno = -sid; @@ -1219,6 +1218,8 @@ socketpair (int domain, int type, int protocol, int fds[2]) if (((domain == AF_INET) || (domain == AF_INET6)) && ((sock_type == SOCK_STREAM) || (sock_type == SOCK_DGRAM))) { + func_str = __func__; + clib_warning ("LDP<%d>: LDP-TBD", getpid ()); errno = ENOSYS; rv = -1; @@ -1266,7 +1267,6 @@ bind (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len) func_str = "vppcom_session_bind"; - ep.vrf = VPPCOM_VRF_DEFAULT; switch (addr->sa_family) { case AF_INET: @@ -1491,7 +1491,6 @@ connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len) func_str = "vppcom_session_connect"; - ep.vrf = VPPCOM_VRF_DEFAULT; switch (addr->sa_family) { case AF_INET: @@ -1585,8 +1584,6 @@ getpeername (int fd, __SOCKADDR_ARG addr, socklen_t * __restrict len) if ((errno = -vcom_init ())) return -1; - clib_warning ("LDP<%d>: fd %d (0x%x) ", getpid (), fd, fd); - if (sid != INVALID_SESSION_ID) { vppcom_endpt_t ep; @@ -2019,7 +2016,6 @@ sendto (int fd, const void *buf, size_t n, int flags, if (addr) { ep = &_ep; - ep->vrf = VPPCOM_VRF_DEFAULT; switch (addr->sa_family) { case AF_INET: @@ -2175,6 +2171,8 @@ sendmsg (int fd, const struct msghdr * message, int flags) if (sid != INVALID_SESSION_ID) { + func_str = __func__; + clib_warning ("LDP<%d>: LDP-TBD", getpid ()); errno = ENOSYS; size = -1; @@ -2269,6 +2267,8 @@ recvmsg (int fd, struct msghdr * message, int flags) if (sid != INVALID_SESSION_ID) { + func_str = __func__; + clib_warning ("LDP<%d>: LDP-TBD", getpid ()); errno = ENOSYS; size = -1; @@ -2360,7 +2360,7 @@ getsockopt (int fd, int level, int optname, int rv; const char *func_str = __func__; u32 sid = vcom_sid_from_fd (fd); - u32 buflen = (u32) * optlen; + u32 buflen = optlen ? (u32) * optlen : 0; if ((errno = -vcom_init ())) return -1; @@ -2500,7 +2500,7 @@ getsockopt (int fd, int level, int optname, if (VCOM_DEBUG > 1) clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): " "sid %u (0x%x), optlen %d", - getpid (), fd, fd, func_str, sid, sid, *optlen); + getpid (), fd, fd, func_str, sid, sid, buflen); rv = vppcom_session_attr (sid, VPPCOM_ATTR_GET_RX_FIFO_LEN, optval, optlen); break; @@ -2818,6 +2818,7 @@ vcom_accept4 (int listen_fd, __SOCKADDR_ARG addr, { vppcom_endpt_t ep; u8 src_addr[sizeof (struct sockaddr_in6)]; + memset (&ep, 0, sizeof (ep)); ep.ip = src_addr; func_str = "vppcom_session_accept"; @@ -2917,6 +2918,8 @@ shutdown (int fd, int how) if (sid != INVALID_SESSION_ID) { + func_str = __func__; + clib_warning ("LDP<%d>: LDP-TBD", getpid ()); errno = ENOSYS; rv = -1; @@ -3107,7 +3110,7 @@ vcom_epoll_pwait (int epfd, struct epoll_event *events, int maxevents, int timeout, const sigset_t * sigmask) { const char *func_str; - int rv; + int rv = 0; double time_to_wait = (double) 0; double time_out, now = 0; u32 vep_idx = vcom_sid_from_fd (epfd); @@ -3187,7 +3190,7 @@ vcom_epoll_pwait (int epfd, struct epoll_event *events, getpid (), epfd, epfd, func_str, libc_epfd, libc_epfd, events, maxevents, sigmask); - rv = libc_epoll_pwait (epfd, events, maxevents, 1, sigmask); + rv = libc_epoll_pwait (libc_epfd, events, maxevents, 1, sigmask); if (rv != 0) goto done; } @@ -3200,6 +3203,8 @@ vcom_epoll_pwait (int epfd, struct epoll_event *events, done: if (VCOM_DEBUG > 3) { + if (libc_epfd > 0) + epfd = libc_epfd; if (rv < 0) { int errno_val = errno;