mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
Minor cleanup
This commit is contained in:
parent
8542ba0db6
commit
4e592dd82e
|
@ -1,3 +1,21 @@
|
||||||
|
/**
|
||||||
|
* (C) 2007-20 - ntop.org and contributors
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not see see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "n2n.h"
|
#include "n2n.h"
|
||||||
|
|
||||||
static int keep_running;
|
static int keep_running;
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/**
|
||||||
|
* (C) 2007-20 - ntop.org and contributors
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not see see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "n2n.h"
|
#include "n2n.h"
|
||||||
|
|
||||||
static int keep_running;
|
static int keep_running;
|
||||||
|
|
6
src/sn.c
6
src/sn.c
|
@ -21,14 +21,8 @@
|
||||||
#include "n2n.h"
|
#include "n2n.h"
|
||||||
#include "header_encryption.h"
|
#include "header_encryption.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static n2n_sn_t sss_node;
|
static n2n_sn_t sss_node;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Load the list of allowed communities. Existing/previous ones will be removed
|
/** Load the list of allowed communities. Existing/previous ones will be removed
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/**
|
||||||
|
* (C) 2007-20 - ntop.org and contributors
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not see see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "n2n.h"
|
#include "n2n.h"
|
||||||
|
|
||||||
#define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out)
|
#define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out)
|
||||||
|
@ -418,7 +436,7 @@ static int process_mgmt(n2n_sn_t *sss,
|
||||||
HASH_ITER(hh, sss->communities, community, tmp) {
|
HASH_ITER(hh, sss->communities, community, tmp) {
|
||||||
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize,
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize,
|
||||||
"community: %s\n", community->community);
|
"community: %s\n", community->community);
|
||||||
sendto_mgmt(sss, sender_sock, resbuf, ressize);
|
sendto_mgmt(sss, sender_sock, (const uint8_t *)resbuf, ressize);
|
||||||
ressize = 0;
|
ressize = 0;
|
||||||
|
|
||||||
num = 0;
|
num = 0;
|
||||||
|
@ -428,14 +446,14 @@ static int process_mgmt(n2n_sn_t *sss,
|
||||||
++num, macaddr_str(mac_buf, peer->mac_addr),
|
++num, macaddr_str(mac_buf, peer->mac_addr),
|
||||||
sock_to_cstr(sockbuf, &(peer->sock)), now-peer->last_seen);
|
sock_to_cstr(sockbuf, &(peer->sock)), now-peer->last_seen);
|
||||||
|
|
||||||
sendto_mgmt(sss, sender_sock, resbuf, ressize);
|
sendto_mgmt(sss, sender_sock, (const uint8_t *)resbuf, ressize);
|
||||||
ressize = 0;
|
ressize = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ressize += snprintf(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize,
|
ressize += snprintf(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize,
|
||||||
"\n");
|
"\n");
|
||||||
sendto_mgmt(sss, sender_sock, resbuf, ressize);
|
sendto_mgmt(sss, sender_sock, (const uint8_t *)resbuf, ressize);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user