*(int *)optval = si->family;
return 0;
#endif /* SO_DOMAIN */
+
+#ifdef SO_PROTOCOL
case SO_PROTOCOL:
if (optval == NULL || optlen == NULL ||
*optlen < (socklen_t)sizeof(int)) {
*optlen = sizeof(int);
*(int *)optval = si->protocol;
return 0;
+#endif /* SO_PROTOCOL */
case SO_TYPE:
if (optval == NULL || optlen == NULL ||
*optlen < (socklen_t)sizeof(int)) {
#ifdef SO_DOMAIN
int so_domain = -1;
#endif /* SO_DOMAIN */
+#ifdef SO_PROTOCOL
int so_protocol = -1;
int so_type = -1;
+#endif /* SO_PROTOCOL */
int rc;
int s;
assert_int_equal(so_len, sizeof(int));
#endif /* SO_DOMAIN */
+#ifdef SO_PROTOCOL
so_len = sizeof(so_protocol);
rc = getsockopt(s,
SOL_SOCKET,
assert_return_code(rc, errno);
assert_int_equal(so_type, SOCK_STREAM);
assert_int_equal(so_len, sizeof(int));
+#endif /* SO_PROTOCOL */
close(s);
}
{
struct sockaddr_in6 sin6;
socklen_t slen = sizeof(struct sockaddr_in6);
- socklen_t so_len;
#ifdef SO_DOMAIN
int so_domain = -1;
#endif /* SO_DOMAIN */
+#ifdef SO_PROTOCOL
+ socklen_t so_len;
int so_protocol = -1;
int so_type = -1;
+#endif /* SO_PROTOCOL */
int rc;
int s;
assert_int_equal(so_len, sizeof(int));
#endif /* SO_DOMAIN */
+#ifdef SO_PROTOCOL
so_len = sizeof(so_protocol);
rc = getsockopt(s,
SOL_SOCKET,
assert_return_code(rc, errno);
assert_int_equal(so_type, SOCK_STREAM);
assert_int_equal(so_len, sizeof(int));
+#endif /* SO_PROTOCOL */
close(s);
}