FreeBSD Bugzilla – Attachment 211136 Details for
Bug 243675
netinet6: Incorrect IPv6 checksum output packets with extension headers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
tool triggering the problem
sendudp+opt.c (text/plain), 1.87 KB, created by
Francis Dupont
on 2020-01-28 17:09:55 UTC
(
hide
)
Description:
tool triggering the problem
Filename:
MIME Type:
Creator:
Francis Dupont
Created:
2020-01-28 17:09:55 UTC
Size:
1.87 KB
patch
obsolete
>/* > * Send to an UDP socket with a pad destination option. > * > * Francis Dupont <fdupont@isc.org> January 2020 > */ > >#include <sys/param.h> >#include <sys/socket.h> > >#ifdef __APPLE__ >#define __APPLE_USE_RFC_3542 >#endif > >#include <netinet/in.h> >#include <netinet/ip6.h> > >#include <arpa/inet.h> > >#include <err.h> >#include <errno.h> >#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <unistd.h> > >struct sockaddr_in6 sin6; >int s; >socklen_t slen; >char src[INET6_ADDRSTRLEN]; >uint8_t dstopt[8]; >struct ip6_opt *opt; >uint8_t pack[8000]; >int cc; > > >int >main(int argc, char *argv[]) >{ > if (argc != 2) > errx(1, "usage: %s <dst>", argv[0]); > > memset(&sin6, 0, sizeof(sin6)); > sin6.sin6_family = AF_INET6; >#ifdef BSD > sin6.sin6_len = sizeof(sin6); >#endif > sin6.sin6_port = htons(12345); > if (inet_pton(AF_INET6, argv[1], &sin6.sin6_addr) != 1) > err(1, "inet_pton(%s)", argv[1]); > s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP); > if (s < 0) > err(1, "socket"); > if (connect(s, (struct sockaddr *)&sin6, sizeof(sin6)) < 0) > err(1, "connect"); > memset(&sin6, 0, sizeof(sin6)); > slen = sizeof(sin6); > if (getsockname(s, (struct sockaddr *)&sin6, &slen) < 0) > err(1, "getsockname"); > if (sin6.sin6_family != AF_INET6) > errx(1, "bad family %d", (int)sin6.sin6_family); > if (inet_ntop(sin6.sin6_family, &sin6.sin6_addr, src, > sizeof(src)) == NULL) > err(1, "inet_ntop"); > memset(&dstopt, 0, sizeof(dstopt)); > opt = (struct ip6_opt *)&dstopt[sizeof(struct ip6_ext)]; > opt->ip6o_type = IP6OPT_PADN; > opt->ip6o_len = 4; > if (setsockopt(s, IPPROTO_IPV6, IPV6_DSTOPTS, dstopt, > sizeof(dstopt)) < 0) > err(1, "setsockopt(IPV6_DSTOPTS)"); > for (;;) { > memset(pack, 0, sizeof(pack)); > printf("send %s -> %s:\n", src, argv[1]); > cc = read(0, pack, sizeof(pack)); > if (cc < 0) > err(1, "read"); > if (cc == 0) > exit(0); > if (send(s, pack, cc, 0) < 0) > err(1, "send"); > } > errx(1, "exit loop"); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 243675
:
211135
| 211136