FreeBSD Bugzilla – Attachment 178855 Details for
Bug 212283
oversized IP datagrams on raw socket with IP_RAWOUTPUT hang network interface drivers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Simple UDP based test program
send_udp.c (text/plain), 1.16 KB, created by
Michael Tuexen
on 2017-01-13 11:02:53 UTC
(
hide
)
Description:
Simple UDP based test program
Filename:
MIME Type:
Creator:
Michael Tuexen
Created:
2017-01-13 11:02:53 UTC
Size:
1.16 KB
patch
obsolete
>#include <sys/types.h> >#include <sys/socket.h> >#include <netinet/in.h> >#include <netinet/ip.h> >#include <arpa/inet.h> >#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <unistd.h> > >int >main(int argc, char *argv[]) >{ > struct sockaddr_in sin; > char *buffer; > int fd, length; > long i, n; > > if (argc != 5) { > fprintf(stderr, "%s", "Usage: send_udp remote_addr remote_port buf_len send_count\n"); > return (-1); > } > if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { > perror("socket"); > } > length = atoi(argv[3]); > if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &length, sizeof(int)) < 0) { > perror("setsockopt"); > } > memset(&sin, 0, sizeof(struct sockaddr_in)); > sin.sin_family = AF_INET; >#if defined(__FreeBSD__) || defined(__APPLE__) > sin.sin_len = sizeof(struct sockaddr_in); >#endif > sin.sin_port = htons(atoi(argv[2])); > sin.sin_addr.s_addr = inet_addr(argv[1]); > buffer = calloc(1, length); > n = atol(argv[4]); > for (i = 0; i < n; i++) { > if (sendto(fd, buffer, length, 0, (const struct sockaddr *)&sin, > (socklen_t)sizeof(struct sockaddr_in)) != length) { > perror("send"); > } > } > if (close(fd) < 0) { > perror("close"); > } > free(buffer); > return (0); >}
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 212283
:
174255
|
174350
|
174351
|
178331
|
178398
|
178409
|
178410
|
178417
| 178855