Der entsprechende Code ist unten, genau wie der Fehler.Sonderfehler mit Setsockopt, "Protokoll nicht verfügbar"
sd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if (setsockopt(sd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)) < 0)
{
printf("%s\n", strerror(errno));
}
if (setsockopt(sd, IPPROTO_IP, IP_DF, &on, sizeof(on)) < 0)
{
printf("%s\n", strerror(errno));
printf("DF\n");
}
Fehler:
[email protected]:~# gcc main.c
main.c: In function ‘main’:
main.c:71: warning: format not a string literal and no format arguments
[email protected]:~# ./a.out localhost
Protocol not available
DF
Es ist seltsam, dass die zweite setsockopt ist erroring, während der erste nicht ist.
Lesen Sie die ip (7) man Seite, ich kann nicht finden, wie man es nicht defragmentieren. Hilfe? – W00t