rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip));
auth->l_port = (uint16_t)atoi(l_port); /* should be safe */
(void) rb_inet_pton_sock(l_ip, (struct sockaddr *)&auth->l_addr);
+ SET_SS_PORT(&auth->l_addr, htons(auth->l_port));
rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip));
auth->c_port = (uint16_t)atoi(c_port);
(void) rb_inet_pton_sock(c_ip, (struct sockaddr *)&auth->c_addr);
-
-#ifdef RB_IPV6
- if(GET_SS_FAMILY(&auth->l_addr) == AF_INET6)
- ((struct sockaddr_in6 *)&auth->l_addr)->sin6_port = htons(auth->l_port);
- else
-#endif
- ((struct sockaddr_in *)&auth->l_addr)->sin_port = htons(auth->l_port);
-
-#ifdef RB_IPV6
- if(GET_SS_FAMILY(&auth->c_addr) == AF_INET6)
- ((struct sockaddr_in6 *)&auth->c_addr)->sin6_port = htons(auth->c_port);
- else
-#endif
- ((struct sockaddr_in *)&auth->c_addr)->sin_port = htons(auth->c_port);
+ SET_SS_PORT(&auth->c_addr, htons(auth->c_port));
rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname));
rb_strlcpy(auth->username, "*", sizeof(auth->username));