version 1.65, 2021/07/12 15:09:20 |
version 1.66, 2022/08/06 23:35:30 |
|
|
socklen_t melen, themlen; |
socklen_t melen, themlen; |
struct sockaddr_in *in4; |
struct sockaddr_in *in4; |
struct sockaddr_in6 *in6; |
struct sockaddr_in6 *in6; |
char tmp1[64], tmp2[64]; |
|
int nretry; |
int nretry; |
|
|
nretry = 10; |
nretry = 10; |
|
|
if (me.ss_family != AF_INET && me.ss_family != AF_INET6) |
if (me.ss_family != AF_INET && me.ss_family != AF_INET6) |
errx(1, "%s: unknown socket family", __func__); |
errx(1, "%s: unknown socket family", __func__); |
if (ptb->vflag >= 2) { |
if (ptb->vflag >= 2) { |
|
char tmp1[NI_MAXHOST + 2 + NI_MAXSERV]; |
|
char tmp2[NI_MAXHOST + 2 + NI_MAXSERV]; |
|
|
saddr_ntop((struct sockaddr *)&me, me.ss_len, |
saddr_ntop((struct sockaddr *)&me, me.ss_len, |
tmp1, sizeof(tmp1)); |
tmp1, sizeof(tmp1)); |
saddr_ntop((struct sockaddr *)&them, them.ss_len, |
saddr_ntop((struct sockaddr *)&them, them.ss_len, |
|
|
continue; |
continue; |
} |
} |
if (ptb->vflag >= 2) { |
if (ptb->vflag >= 2) { |
|
char tmp1[NI_MAXHOST]; |
|
char tmp2[NI_MAXHOST]; |
|
|
inet_ntop(AF_INET, &inpcb.inp_laddr, |
inet_ntop(AF_INET, &inpcb.inp_laddr, |
tmp1, sizeof(tmp1)); |
tmp1, sizeof(tmp1)); |
inet_ntop(AF_INET, &inpcb.inp_faddr, |
inet_ntop(AF_INET, &inpcb.inp_faddr, |
|
|
if ((inpcb.inp_flags & INP_IPV6) == 0) |
if ((inpcb.inp_flags & INP_IPV6) == 0) |
continue; |
continue; |
if (ptb->vflag >= 2) { |
if (ptb->vflag >= 2) { |
|
char tmp1[NI_MAXHOST]; |
|
char tmp2[NI_MAXHOST]; |
|
|
inet_ntop(AF_INET6, &inpcb.inp_laddr6, |
inet_ntop(AF_INET6, &inpcb.inp_laddr6, |
tmp1, sizeof(tmp1)); |
tmp1, sizeof(tmp1)); |
inet_ntop(AF_INET6, &inpcb.inp_faddr6, |
inet_ntop(AF_INET6, &inpcb.inp_faddr6, |
|
|
struct statctx *sc; |
struct statctx *sc; |
struct sockaddr_storage ss; |
struct sockaddr_storage ss; |
socklen_t sslen; |
socklen_t sslen; |
char tmp[128]; |
char tmp[NI_MAXHOST + 2 + NI_MAXSERV]; |
|
|
sslen = sizeof(ss); |
sslen = sizeof(ss); |
|
|
|
|
static void |
static void |
server_init(struct addrinfo *aitop) |
server_init(struct addrinfo *aitop) |
{ |
{ |
char tmp[128]; |
|
int sock, on = 1; |
int sock, on = 1; |
struct addrinfo *ai; |
struct addrinfo *ai; |
struct event *ev; |
struct event *ev; |
|
|
|
|
lnfds = 0; |
lnfds = 0; |
for (ai = aitop; ai != NULL; ai = ai->ai_next) { |
for (ai = aitop; ai != NULL; ai = ai->ai_next) { |
|
char tmp[NI_MAXHOST + 2 + NI_MAXSERV]; |
|
|
saddr_ntop(ai->ai_addr, ai->ai_addrlen, tmp, sizeof(tmp)); |
saddr_ntop(ai->ai_addr, ai->ai_addrlen, tmp, sizeof(tmp)); |
if (ptb->vflag) |
if (ptb->vflag) |
fprintf(stderr, "Try to bind to %s\n", tmp); |
fprintf(stderr, "Try to bind to %s\n", tmp); |
|
|
{ |
{ |
struct statctx *sc; |
struct statctx *sc; |
struct addrinfo *ai; |
struct addrinfo *ai; |
char tmp[128]; |
|
int i, r, sock; |
int i, r, sock; |
|
|
for (i = 0; i < nconn; i++) { |
for (i = 0; i < nconn; i++) { |
for (sock = -1, ai = aitop; ai != NULL; ai = ai->ai_next) { |
for (sock = -1, ai = aitop; ai != NULL; ai = ai->ai_next) { |
|
char tmp[NI_MAXHOST + 2 + NI_MAXSERV]; |
|
|
saddr_ntop(ai->ai_addr, ai->ai_addrlen, tmp, |
saddr_ntop(ai->ai_addr, ai->ai_addrlen, tmp, |
sizeof(tmp)); |
sizeof(tmp)); |
if (ptb->vflag && i == 0) |
if (ptb->vflag && i == 0) |