Partial fixes for addressing compilation issues introduced by https://github.com/ntop/n2n/pull/460

This commit is contained in:
Luca Deri 2020-10-11 11:57:48 +02:00
parent c9eedd68f0
commit f6e4047ce0
8 changed files with 682 additions and 664 deletions

View File

@ -82,6 +82,9 @@ enum federation{IS_NO_FEDERATION = 0,IS_FEDERATION = 1};
#define COMMUNITY_UNPURGEABLE 0
#define COMMUNITY_PURGEABLE 1
#define SN_UNPURGEABLE 0 /* FIX fcarli3 */
#define SN_PURGEABLE 1 /* FIX fcarli3 */
/* Header encryption indicators */
#define HEADER_ENCRYPTION_UNKNOWN 0
#define HEADER_ENCRYPTION_NONE 1

View File

@ -11,4 +11,3 @@ dh_link
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb

View File

@ -1,4 +1,4 @@
# Automatically added by dh_installdebconf
# Automatically added by dh_installdebconf/11.1.6ubuntu2
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge

View File

@ -1 +1,2 @@
misc:Depends=debconf (>= 0.5) | debconf-2.0
misc:Pre-Depends=

View File

@ -1940,12 +1940,13 @@ void readFromIPSocket(n2n_edge_t * eee, int in_sock) {
if(0 == memcmp(ra.cookie, eee->last_cookie, N2N_COOKIE_SIZE))
{
if(ra.num_sn > 0)
#if 0
if(ra.num_sn > 0) /* FIX fcarli3 */
{
traceEvent(TRACE_NORMAL, "Rx REGISTER_SUPER_ACK backup supernode at %s",
sock_to_cstr(sockbuf1, &(ra.sn_bak)));
}
#endif
eee->last_sup = now;
eee->sn_wait=0;
eee->sup_attempts = N2N_EDGE_SUP_ATTEMPTS; /* refresh because we got a response */

View File

@ -251,7 +251,12 @@ static int setOption(int optkey, char *_optarg, n2n_sn_t *sss) {
anchor_sn->ip_addr = calloc(1,N2N_EDGE_SN_HOST_SIZE);
if(anchor_sn->ip_addr){
strncpy(anchor_sn->ip_addr,_optarg,N2N_EDGE_SN_HOST_SIZE-1);
rv = supernode2sock(socket,_optarg);
#if 1
rv = -1;
#else
rv = supernode2sock(socket,_optarg); /* FIX fcarli3 */
#endif
if(rv != 0){
traceEvent(TRACE_WARNING, "Invalid socket");

View File

@ -510,7 +510,6 @@ static int find_edge_time_stamp_and_verify (struct peer_info * edges,
return ( time_stamp_verify_and_update (stamp, previous_stamp, allow_jitter) );
}
static int re_register_and_purge_supernodes(n2n_sn_t *sss, struct sn_community *comm, time_t now) {
time_t time;
struct peer_info *peer, *tmp;
@ -519,7 +518,11 @@ static int re_register_and_purge_supernodes(n2n_sn_t *sss, struct sn_community *
HASH_ITER(hh,comm->edges,peer,tmp) {
time = now - peer->last_seen;
if(time <= ALLOWED_TIME) continue;
if((time < PURGE_FEDERATION_NODE_INTERVAL) || (peer->purgeable == SN_UNPURGEABLE)){ /* re-regitser (send REGISTER_SUPER) */
if((time < PURGE_FEDERATION_NODE_INTERVAL)
|| (peer->purgeable == SN_UNPURGEABLE) /* FIX fcarli3 */
) {
/* re-regitser (send REGISTER_SUPER) */
uint8_t pktbuf[N2N_PKT_BUF_SIZE] = {0};
size_t idx;
/* ssize_t sent; */

View File

@ -405,11 +405,14 @@ int encode_REGISTER_SUPER_ACK(uint8_t *base,
retval += encode_uint16(base, idx, reg->lifetime);
retval += encode_sock(base, idx, &(reg->sock));
retval += encode_uint8(base, idx, reg->num_sn);
#if 0 /* FIX fcarli3 */
if (reg->num_sn > 0) {
/* We only support 0 or 1 at this stage */
retval += encode_sock(base, idx, &(reg->sn_bak));
retval += encode_mac(base, idx, reg->mac_addr);
}
#endif
return retval;
}
@ -434,11 +437,14 @@ int decode_REGISTER_SUPER_ACK(n2n_REGISTER_SUPER_ACK_t *reg,
/* Following the edge socket are an array of backup supernodes. */
retval += decode_uint8(&(reg->num_sn), base, rem, idx);
#if 0 /* FIX fcarli3 */
if (reg->num_sn > 0) {
/* We only support 0 or 1 at this stage */
retval += decode_sock(&(reg->sn_bak), base, rem, idx);
retval += decode_mac(reg->mac_addr, base, rem, idx);
}
#endif
return retval;
}