#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/un.h>
-#if defined(HAVE_SIN6_SCOPE_ID_LINUX)
-# define in6_addr in6_addr_libc
-# define ipv6_mreq ipv6_mreq_libc
-# define sockaddr_in6 sockaddr_in6_libc
-#endif
#include <netinet/in.h>
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
# include <linux/ipx.h>
#endif
-#if defined(__GLIBC__) && defined(HAVE_SIN6_SCOPE_ID_LINUX)
-# if defined(HAVE_LINUX_IN6_H)
-# if defined(HAVE_SIN6_SCOPE_ID_LINUX)
-# undef in6_addr
-# undef ipv6_mreq
-# undef sockaddr_in6
-# define in6_addr in6_addr_kernel
-# define ipv6_mreq ipv6_mreq_kernel
-# define sockaddr_in6 sockaddr_in6_kernel
-# endif
-# include <linux/in6.h>
-# if defined(HAVE_SIN6_SCOPE_ID_LINUX)
-# undef in6_addr
-# undef ipv6_mreq
-# undef sockaddr_in6
-# define in6_addr in6_addr_libc
-# define ipv6_mreq ipv6_mreq_libc
-# define sockaddr_in6 sockaddr_in6_kernel
-# endif
-# endif
-#endif
-
#if defined(HAVE_LINUX_NETLINK_H)
# include <linux/netlink.h>
#endif
default:
tprints("sa_data=");
- printstr(tcp, (long) &((struct sockaddr *) addr)->sa_data,
- sizeof addrbuf.sa.sa_data);
+ print_quoted_string(addrbuf.sa.sa_data,
+ sizeof(addrbuf.sa.sa_data), 0);
break;
}
tprints("}");
return 0;
}
+#ifdef MCAST_JOIN_GROUP
+static void
+print_group_req(struct tcb *tcp, long addr, int len)
+{
+ struct group_req greq;
+
+ if (len != sizeof(greq) ||
+ umove(tcp, addr, &greq) < 0) {
+ tprintf("%#lx", addr);
+ return;
+ }
+
+ union {
+ struct sockaddr *sa;
+ struct sockaddr_in *sin;
+#ifdef HAVE_INET_NTOP
+ struct sockaddr_in6 *sin6;
+#endif
+ } a = { .sa = (struct sockaddr *) &greq.gr_group };
+#ifdef HAVE_INET_NTOP
+ char str[INET6_ADDRSTRLEN];
+#endif
+
+ tprintf("{gr_interface=%u, gr_group={sa_family=", greq.gr_interface);
+ printxval(addrfams, a.sa->sa_family, "AF_???");
+
+ switch (a.sa->sa_family) {
+ case AF_INET:
+ tprintf(", sin_port=htons(%u), sin_addr=inet_addr(\"%s\")}}",
+ ntohs(a.sin->sin_port),
+ inet_ntoa(a.sin->sin_addr));
+ return;
+#ifdef HAVE_INET_NTOP
+ case AF_INET6:
+ if (!inet_ntop(AF_INET6, &a.sin6->sin6_addr, str, sizeof(str)))
+ break;
+ tprintf(", sin6_port=htons(%u)"
+ ", inet_pton(AF_INET6, \"%s\", &sin6_addr)}}",
+ ntohs(a.sin6->sin6_port), str);
+ return;
+#endif /* HAVE_INET_NTOP */
+ }
+
+ tprints(", sa_data=");
+ print_quoted_string(a.sa->sa_data, sizeof(a.sa->sa_data), 0);
+ tprintf("}}");
+
+}
+#endif /* MCAST_JOIN_GROUP */
+
#ifdef PACKET_RX_RING
static void
print_tpacket_req(struct tcb *tcp, long addr, int len)
}
break;
+ case SOL_IP:
+ switch (name) {
+#ifdef MCAST_JOIN_GROUP
+ case MCAST_JOIN_GROUP:
+ case MCAST_LEAVE_GROUP:
+ print_group_req(tcp, addr, len);
+ goto done;
+#endif /* MCAST_JOIN_GROUP */
+ }
+ break;
+
case SOL_PACKET:
switch (name) {
#ifdef PACKET_RX_RING