Skip to content
Browse files

fix no buffer space available.

  • Loading branch information...
1 parent 6612ad0 commit 3ce960417ea81e099e6e705ac4d4023bb67938d2 upa committed Apr 26, 2012
Showing with 11 additions and 5 deletions.
  1. +5 −5 net.c
  2. +6 −0 sockaddrmacro.h
View
10 net.c
@@ -155,22 +155,22 @@ send_etherflame_from_local_to_vxlan (struct vxlan_instance * vins,
mhdr.msg_iov = iov;
mhdr.msg_iovlen = 2;
+ mhdr.msg_controllen = 0;
if ((entry = fdb_search_entry (vins->fdb, ether->ether_dhost)) == NULL) {
mhdr.msg_name = &vxlan.mcast_addr;
- mhdr.msg_namelen = sizeof (vxlan.mcast_addr);
+ mhdr.msg_namelen = EXTRACT_SALEN (vxlan.mcast_addr);
if (sendmsg (vxlan.udp_sock, &mhdr, 0) < 0)
- error_warn("sendmsg to multicast failed : %s",
- strerror (errno));
+ error_warn ("sendmsg to multicast failed %s",
+ strerror (errno));
} else {
EXTRACT_PORT (entry->vtep_addr) = htons (VXLAN_PORT_BASE);
mhdr.msg_name = &entry->vtep_addr;
- mhdr.msg_namelen = sizeof (entry->vtep_addr);
+ mhdr.msg_namelen = EXTRACT_SALEN (entry->vtep_addr);
if (sendmsg (vxlan.udp_sock, &mhdr, 0) < 0)
error_warn ("sendmsg to unicast failed : %s",
strerror (errno));
}
-
return;
}
View
6 sockaddrmacro.h
@@ -18,6 +18,12 @@
#define EXTRACT_FAMILY(sa) \
(((struct sockaddr *)(&(sa)))->sa_family)
+#define EXTRACT_SALEN(sa) \
+ (EXTRACT_FAMILY(sa) == AF_INET) ? sizeof (struct sockaddr_in) : \
+ (EXTRACT_FAMILY(sa) == AF_INET6) ? sizeof (struct sockaddr_in6) : \
+ -1
+
+
#define EXTRACT_PORT(sa) (((struct sockaddr_in *)&(sa))->sin_port)
#define INET_STOP(sa, c) \

0 comments on commit 3ce9604

Please sign in to comment.
Something went wrong with that request. Please try again.