Page MenuHomeFreeBSD
Authored By
tuexen
Jan 5 2019, 12:41 PM
Size
526 B
Referenced Files
None
Subscribers
None

ip_options.c

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <unistd.h>
int main(void)
{
int fd;
socklen_t len;
char val[] = {0x00, 0x00, 0x00, 0x00, 0xac, 0x14, 0x00, 0xaa};
len = (socklen_t)sizeof(val);
if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
perror("socket");
}
if (setsockopt(fd, IPPROTO_IP, IP_OPTIONS, val, len) != 0) {
perror("setsockopt");
}
if (getsockopt(fd, IPPROTO_IP, IP_OPTIONS, val, &len) != 0) {
perror("getsockopt");
}
return (0);
}

File Metadata

Mime Type
text/x-c
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1705652
Default Alt Text
ip_options.c (526 B)

Event Timeline