Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Commit 12be05a

Browse files
committed
IPv6 addresses are 16-bytes long, duh.
1 parent d6dbc2d commit 12be05a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The entire set of arguments can be invoked with `stud -h`:
6868

6969
Special:
7070
--write-ip (write 1 octet with the IP family followed by
71-
4 (IPv4) or 8 (IPv6) octets little-endian
71+
4 (IPv4) or 16 (IPv6) octets little-endian
7272
to backend before the actual data)
7373

7474
`stud` uses no configuration file.

stud.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ static void handle_connect(struct ev_loop *loop, ev_io *w, int revents) {
341341
*ring_pnt++ = (unsigned char) ps->remote_ip.ss_family;
342342
if (ps->remote_ip.ss_family == AF_INET6) {
343343
memcpy(ring_pnt, &((struct sockaddr_in6 *) &ps->remote_ip)
344-
->sin6_addr.s6_addr, 8U);
345-
ringbuffer_write_append(&ps->ring_down, 1U + 8U);
344+
->sin6_addr.s6_addr, 16U);
345+
ringbuffer_write_append(&ps->ring_down, 1U + 16U);
346346
} else {
347347
memcpy(ring_pnt, &((struct sockaddr_in *) &ps->remote_ip)
348348
->sin_addr.s_addr, 4U);
@@ -611,7 +611,7 @@ static void usage_fail(char *prog, char *msg) {
611611
"\n"
612612
"Special:\n"
613613
" --write-ip (write 1 octet with the IP family followed by\n"
614-
" 4 (IPv4) or 8 (IPv6) octets little-endian\n"
614+
" 4 (IPv4) or 16 (IPv6) octets little-endian\n"
615615
" to backend before the actual data)\n"
616616
);
617617
exit(1);

0 commit comments

Comments
 (0)