FreeBSD returns a socklen of sockaddr_storage when doing an accept on an unix
STREAM socket. The current code will assume it means a sun_path larger than 0.

That breaks some tests like the one below which don't expect to find "unix::" on
the logs.

As a Linux abstract address would not have a more useful name either, it's
better to check that sun_path starts with a non-zero byte as well as checking
the length.

402: ovs-ofctl replace-flows with --bundle      FAILED (ovs-ofctl.at:2928)
2016-07-08T12:44:30.068Z|00020|vconn|DBG|unix:: sent (Success): OFPT_HELLO 
(OF1.6) (xid=0x1):

Signed-off-by: Thadeu Lima de Souza Cascardo <casca...@redhat.com>
---
 lib/stream-unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/stream-unix.c b/lib/stream-unix.c
index cadd180..76206f8 100644
--- a/lib/stream-unix.c
+++ b/lib/stream-unix.c
@@ -113,7 +113,7 @@ punix_accept(int fd, const struct sockaddr_storage *ss, 
size_t ss_len,
     int name_len = get_unix_name_len(ss_len);
     char name[128];
 
-    if (name_len > 0) {
+    if (name_len > 0 && sun->sun_path[0] != 0) {
         snprintf(name, sizeof name, "unix:%.*s", name_len, sun->sun_path);
     } else {
         strcpy(name, "unix");
-- 
2.7.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to