static void
print_set_linger(struct tcb *const tcp, const kernel_ulong_t addr,
- const unsigned int len)
+ const int len)
{
struct linger linger;
- if (len < sizeof(linger) ||
- umove(tcp, addr, &linger) < 0) {
+ if (len < (int) sizeof(linger)) {
printaddr(addr);
- return;
+ } else if (!umove_or_printaddr(tcp, addr, &linger)) {
+ PRINT_FIELD_D("{", linger, l_onoff);
+ PRINT_FIELD_D(", ", linger, l_linger);
+ tprints("}");
}
-
- PRINT_FIELD_D("{", linger, l_onoff);
- PRINT_FIELD_D(", ", linger, l_linger);
- tprints("}");
}
static void
#ifdef IP_ADD_MEMBERSHIP
static void
print_mreq(struct tcb *const tcp, const kernel_ulong_t addr,
- const unsigned int len)
+ const int len)
{
struct ip_mreq mreq;
- if (len < sizeof(mreq)) {
- printstrn(tcp, addr, len);
- return;
+ if (len < (int) sizeof(mreq)) {
+ printaddr(addr);
+ } else if (!umove_or_printaddr(tcp, addr, &mreq)) {
+ PRINT_FIELD_INET4_ADDR("{", mreq, imr_multiaddr);
+ PRINT_FIELD_INET4_ADDR(", ", mreq, imr_interface);
+ tprints("}");
}
- if (umove_or_printaddr(tcp, addr, &mreq))
- return;
-
- PRINT_FIELD_INET4_ADDR("{", mreq, imr_multiaddr);
- PRINT_FIELD_INET4_ADDR(", ", mreq, imr_interface);
- tprints("}");
}
#endif /* IP_ADD_MEMBERSHIP */
#ifdef IPV6_ADD_MEMBERSHIP
static void
print_mreq6(struct tcb *const tcp, const kernel_ulong_t addr,
- const unsigned int len)
+ const int len)
{
struct ipv6_mreq mreq;
- if (len < sizeof(mreq)) {
- printstrn(tcp, addr, len);
- return;
- }
- if (umove_or_printaddr(tcp, addr, &mreq))
- return;
-
- PRINT_FIELD_INET_ADDR("{", mreq, ipv6mr_multiaddr, AF_INET6);
- PRINT_FIELD_IFINDEX(", ", mreq, ipv6mr_interface);
- tprints("}");
-}
-#endif /* IPV6_ADD_MEMBERSHIP */
-
-#ifdef MCAST_JOIN_GROUP
-static void
-print_group_req(struct tcb *const tcp, const kernel_ulong_t addr, const int len)
-{
- struct group_req greq;
-
- if (len != sizeof(greq) ||
- umove(tcp, addr, &greq) < 0) {
+ if (len < (int) sizeof(mreq)) {
printaddr(addr);
- return;
+ } else if (!umove_or_printaddr(tcp, addr, &mreq)) {
+ PRINT_FIELD_INET_ADDR("{", mreq, ipv6mr_multiaddr, AF_INET6);
+ PRINT_FIELD_IFINDEX(", ", mreq, ipv6mr_interface);
+ tprints("}");
}
-
- PRINT_FIELD_IFINDEX("{", greq, gr_interface);
- PRINT_FIELD_SOCKADDR(", ", greq, gr_group);
- tprints("}");
-
}
-#endif /* MCAST_JOIN_GROUP */
+#endif /* IPV6_ADD_MEMBERSHIP */
#ifdef PACKET_RX_RING
static void
print_mreq6(tcp, addr, len);
return;
#endif /* IPV6_ADD_MEMBERSHIP */
+#ifdef MCAST_JOIN_GROUP
+ case MCAST_JOIN_GROUP:
+ case MCAST_LEAVE_GROUP:
+ print_group_req(tcp, addr, len);
+ return;
+#endif /* MCAST_JOIN_GROUP */
}
break;