Przeglądaj źródła

error mgmt

tags/v1.0.0
Pascal Gloor 5 lat temu
rodzic
commit
acf922717c
1 zmienionych plików z 15 dodań i 3 usunięć
  1. 15
    3
      dhcp_protect.c

+ 15
- 3
dhcp_protect.c Wyświetl plik

// dhcp_protect.c
// DHCP Protect
//
// Copyright 2019 Pascal Gloor // Copyright 2019 Pascal Gloor
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
static char buf[65536]; static char buf[65536];
int rv; int rv;


if ((rv = recv(fd, buf, sizeof(buf), 0)) >= 0) {
nfq_handle_packet(h, buf, rv); /* send packet to callback */
rv = recv(fd, buf, sizeof(buf), 0);

switch(rv) {
case -1:
fprintf(stderr, "recv() error: %s\n", strerror(errno));
return;
case 0:
fprintf(stderr,"socket is closed!?\n");
return;
default:
// send packet to callback
nfq_handle_packet(h, buf, rv);
break;
} }
} }
} }

Ładowanie…
Anuluj
Zapisz