Pascal Gloor 5 лет назад
Родитель
Сommit
acf922717c
1 измененных файлов: 15 добавлений и 3 удалений
  1. 15
    3
      dhcp_protect.c

+ 15
- 3
dhcp_protect.c Просмотреть файл

@@ -1,4 +1,5 @@
// dhcp_protect.c
// DHCP Protect
//
// Copyright 2019 Pascal Gloor
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -107,8 +108,19 @@ void dp_nfq_start(dp_conf *conf) {
static char buf[65536];
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;
}
}
}

Загрузка…
Отмена
Сохранить