Browse Source

fixed compile warnings (#647)

pull/648/head
Logan oos Even 4 years ago
committed by GitHub
parent
commit
64b8136301
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/edge.c
  2. 21
      src/edge_utils.c
  3. 1
      src/n2n.c
  4. 15
      src/sn_utils.c
  5. 2
      src/tf.c
  6. 4
      src/transform_cc20.c
  7. 2
      src/transform_speck.c

1
src/edge.c

@ -853,7 +853,6 @@ int main (int argc, char* argv[]) {
fd_set socket_mask; /* for supernode answer */
struct timeval wait_time; /* timeout for sn answer */
size_t bread = 0;
uint16_t expected = sizeof(uint16_t);
uint16_t position = 0;
uint8_t pktbuf[N2N_SN_PKTBUF_SIZE + sizeof(uint16_t)]; /* buffer + prepended buffer length in case of tcp */

21
src/edge_utils.c

@ -863,7 +863,6 @@ static ssize_t sendto_sock (n2n_edge_t *eee, const void * buf,
struct sockaddr_in peer_addr;
ssize_t sent;
int rc;
int value = 0;
if(!dest->family)
@ -957,7 +956,6 @@ void send_query_peer (n2n_edge_t * eee,
n2n_common_t cmn = {0};
n2n_QUERY_PEER_t query = {{0}};
struct peer_info *peer, *tmp;
uint8_t tmp_pkt[N2N_PKT_BUF_SIZE];
int n_o_pings = 0;
int n_o_top_sn = 0;
int n_o_rest_sn = 0;
@ -1307,8 +1305,6 @@ static void send_grat_arps (n2n_edge_t * eee) {
*/
void update_supernode_reg (n2n_edge_t * eee, time_t now) {
struct peer_info *scan, *tmp;
if(eee->sn_wait && (now > (eee->last_register_req + (eee->conf.register_interval/10)))) {
/* fall through */
traceEvent(TRACE_DEBUG, "update_supernode_reg: doing fast retry.");
@ -1395,12 +1391,12 @@ static int handle_PACKET (n2n_edge_t * eee,
if(!memcmp(pkt->dstMac, broadcast_mac, N2N_MAC_SIZE))
++(eee->stats.rx_sup_broadcast);
++(eee->stats.rx_sup);
eee->last_sup = now;
} else {
++(eee->stats.rx_p2p);
eee->last_p2p=now;
}
++(eee->stats.rx_sup);
eee->last_sup = now;
} else {
++(eee->stats.rx_p2p);
eee->last_p2p=now;
}
/* Handle transform. */
{
@ -2145,7 +2141,6 @@ void process_udp (n2n_edge_t *eee, const struct sockaddr_in *sender_sock, const
(signed int)udp_size, sock_to_cstr(sockbuf1, &sender));
if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) {
uint16_t checksum = 0;
if(packet_header_decrypt(udp_buf, udp_size,
(char *)eee->conf.community_name,
eee->conf.header_encryption_ctx, eee->conf.header_iv_ctx,
@ -2447,7 +2442,6 @@ void process_udp (n2n_edge_t *eee, const struct sockaddr_in *sender_sock, const
n2n_PEER_INFO_t pi;
struct peer_info * scan;
int skip_add;
SN_SELECTION_CRITERION_DATA_TYPE data;
decode_PEER_INFO(&pi, &cmn, udp_buf, &rem, &idx);
@ -2649,7 +2643,6 @@ int run_edge_loop (n2n_edge_t *eee, int *keep_running) {
fd_set socket_mask;
struct timeval wait_time;
time_t now;
size_t bread;
FD_ZERO(&socket_mask);
@ -2820,8 +2813,6 @@ void edge_term (n2n_edge_t * eee) {
static int edge_init_sockets (n2n_edge_t *eee) {
int sockopt;
if(eee->udp_mgmt_sock >= 0)
closesocket(eee->udp_mgmt_sock);

1
src/n2n.c

@ -270,7 +270,6 @@ int supernode2sock (n2n_sock_t * sn, const n2n_sn_name_t addrIn) {
supernode_host = strtok(addr, ":");
if(supernode_host) {
in_addr_t sn_addr;
char *supernode_port = strtok(NULL, ":");
const struct addrinfo aihints = {0, PF_INET, 0, 0, 0, NULL, NULL, NULL};
struct addrinfo * ainfo = NULL;

15
src/sn_utils.c

@ -108,8 +108,6 @@ static ssize_t sendto_fd (n2n_sn_t *sss,
size_t pktsize) {
ssize_t sent = 0;
struct sn_community *comm, *tmp_comm;
struct peer_info *edge, *tmp_edge;
n2n_tcp_connection_t *conn;
sent = sendto(socket_fd, pktbuf, pktsize, 0 /* flags */,
@ -694,7 +692,6 @@ static signed int peer_tap_ip_sort (struct peer_info *a, struct peer_info *b) {
/** The IP address assigned to the edge by the auto ip address function of sn. */
static int assign_one_ip_addr (struct sn_community *comm, n2n_desc_t dev_desc, n2n_ip_subnet_t *ip_addr) {
struct peer_info *peer, *tmp_peer;
uint32_t tmp, success, net_id, mask, max_host, host_id = 1;
dec_ip_bit_str_t ip_bit_str = {'\0'};
@ -1442,14 +1439,11 @@ static int process_udp (n2n_sn_t * sss,
n2n_REGISTER_SUPER_NAK_t nak;
n2n_common_t cmn2;
uint8_t ackbuf[N2N_SN_PKTBUF_SIZE];
uint8_t *tmp_dst;
uint8_t payload_buf[REG_SUPER_ACK_PAYLOAD_SPACE];
n2n_REGISTER_SUPER_ACK_payload_t *payload;
size_t encx = 0;
struct sn_community *fed;
struct sn_community_regular_expression *re, *tmp_re;
struct peer_info *peer, *tmp_peer, *p;
node_supernode_association_t *assoc;
int8_t allowed_match = -1;
uint8_t match = 0;
int match_length = 0;
@ -1720,16 +1714,12 @@ static int process_udp (n2n_sn_t * sss,
case MSG_TYPE_REGISTER_SUPER_ACK: {
n2n_REGISTER_SUPER_ACK_t ack;
size_t encx = 0;
struct sn_community *fed;
struct peer_info *scan, *tmp;
n2n_sock_str_t sockbuf1;
n2n_sock_str_t sockbuf2;
macstr_t mac_buf1;
n2n_sock_t sender;
n2n_sock_t *orig_sender;
n2n_sock_t *tmp_sock;
n2n_mac_t *tmp_mac;
int i;
uint8_t dec_tmpbuf[REG_SUPER_ACK_PAYLOAD_SPACE];
n2n_REGISTER_SUPER_ACK_payload_t *payload;
@ -1800,7 +1790,6 @@ static int process_udp (n2n_sn_t * sss,
}
case MSG_TYPE_REGISTER_SUPER_NAK: {
n2n_common_t cmn2;
n2n_REGISTER_SUPER_NAK_t nak;
uint8_t nakbuf[N2N_SN_PKTBUF_SIZE];
size_t encx = 0;
@ -1875,11 +1864,9 @@ static int process_udp (n2n_sn_t * sss,
n2n_common_t cmn2;
n2n_PEER_INFO_t pi;
struct sn_community_regular_expression *re, *tmp_re;
struct peer_info *peer, *tmp_peer, *p;
int8_t allowed_match = -1;
uint8_t match = 0;
int match_length = 0;
uint8_t *rec_buf; /* either udp_buf or encbuf */
if(!comm && sss->lock_communities) {
HASH_ITER(hh, sss->rules, re, tmp_re) {
@ -2081,8 +2068,6 @@ int run_sn_loop (n2n_sn_t *sss, int *keep_running) {
int max_sock;
fd_set socket_mask;
n2n_tcp_connection_t *conn, *tmp_conn;
struct sn_community *comm, *tmp_comm;
struct peer_info *edge, *tmp_edge;
SOCKET tmp_sock;
n2n_sock_str_t sockbuf;

2
src/tf.c

@ -476,7 +476,7 @@ int tf_cbc_decrypt (unsigned char *out, const unsigned char *in, size_t in_len,
const unsigned char *iv, tf_context_t *ctx) {
int n; /* number of blocks */
int ret = (int)in_len & 15; /* remainder */
/* int ret = (int)in_len & 15; remainder, unused*/
uint8_t ivec[TF_BLOCK_SIZE]; /* the ivec/old handling might be optimized if we */
uint8_t old[TF_BLOCK_SIZE]; /* can be sure that in != out */

4
src/transform_cc20.c

@ -60,7 +60,6 @@ static int transop_encode_cc20 (n2n_trans_op_t *arg,
int len = -1;
transop_cc20_t *priv = (transop_cc20_t *)arg->priv;
uint8_t assembly[N2N_PKT_BUF_SIZE] = { 0 };
if(in_len <= N2N_PKT_BUF_SIZE) {
if((in_len + CC20_PREAMBLE_SIZE) <= out_len) {
@ -100,12 +99,9 @@ static int transop_decode_cc20 (n2n_trans_op_t *arg,
int len = 0;
transop_cc20_t *priv = (transop_cc20_t *)arg->priv;
uint8_t assembly[N2N_PKT_BUF_SIZE];
if(((in_len - CC20_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* cipher text fits in assembly */
&& (in_len >= CC20_PREAMBLE_SIZE)) { /* has at least iv */
size_t rem = in_len;
size_t idx = 0;
traceEvent(TRACE_DEBUG, "decode_cc20 %lu bytes", in_len);

2
src/transform_speck.c

@ -107,8 +107,6 @@ static int transop_decode_speck (n2n_trans_op_t *arg,
if(((in_len - TRANSOP_SPECK_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* cipher text fits in buffer */
&& (in_len >= TRANSOP_SPECK_PREAMBLE_SIZE)) { /* has at least iv */
size_t rem = in_len;
size_t idx = 0;
traceEvent(TRACE_DEBUG, "decode_speck %lu bytes", in_len);

Loading…
Cancel
Save