[Olsr-dev] [PATCH v1 1/1] remove most '#if 0' blocks
Ferry Huberts
(spam-protected)
Tue Aug 28 14:11:13 CEST 2012
From: Ferry Huberts <(spam-protected)>
Leave mpr related blocks alone.
Signed-off-by: Ferry Huberts <(spam-protected)>
---
lib/bmf/src/PacketHistory.c | 31 ---
lib/dot_draw/src/olsrd_dot_draw.c | 3 -
lib/httpinfo/src/admin_interface.c | 10 -
lib/httpinfo/src/olsrd_httpinfo.c | 12 --
lib/httpinfo/src/olsrd_httpinfo.h | 4 -
lib/p2pd/src/PacketHistory.c | 31 ---
lib/secure/src/md5.c | 25 ---
lib/secure/src/olsrd_secure.c | 26 ---
lib/tas/src/plugin.c | 7 -
src/bsd/net.c | 19 --
src/build_msg.c | 3 -
src/common/avl.c | 11 --
src/defs.h | 4 -
src/fpm.c | 20 --
src/fpm.h | 44 -----
src/hna_set.c | 3 -
src/interfaces.c | 16 --
src/ipc_frontend.c | 25 ---
src/linux/kernel_routes_nl.c | 11 --
src/linux/link_layer.c | 378 -------------------------------------
src/linux/net.c | 155 ---------------
src/lq_plugin_default_ff.c | 6 -
src/lq_plugin_default_ffeth.c | 6 -
src/olsr.c | 4 -
src/tc_set.c | 20 --
src/two_hop_neighbor_table.c | 4 -
src/unix/ifnet.c | 35 ----
src/win32/ifnet.c | 17 --
src/win32/net.c | 10 -
29 files changed, 940 deletions(-)
delete mode 100644 src/linux/link_layer.c
diff --git a/lib/bmf/src/PacketHistory.c b/lib/bmf/src/PacketHistory.c
index 040abaa..46b59cf 100644
--- a/lib/bmf/src/PacketHistory.c
+++ b/lib/bmf/src/PacketHistory.c
@@ -59,37 +59,6 @@ static struct TDupEntry* PacketHistory[HISTORY_HASH_SIZE];
#define CRC_UPTO_NBYTES 256
-#if 0
-/* -------------------------------------------------------------------------
- * Function : CalcCrcCcitt
- * Description: Calculate 16-bits CRC according to CRC-CCITT specification
- * Input : buffer - the bytes to calculate the CRC value over
- * len - the number of bytes to calculate the CRC value over
- * Output : none
- * Return : CRC-16 value
- * Data Used : none
- * ------------------------------------------------------------------------- */
-static u_int16_t CalcCrcCcitt(unsigned char* buffer, ssize_t len)
-{
- /* Initial value of 0xFFFF should be 0x1D0F according to
- * www.joegeluso.com/software/articles/ccitt.htm */
- u_int16_t crc = 0xFFFF;
- int i;
-
- assert(buffer != NULL);
-
- for (i = 0; i < len; i++)
- {
- crc = (unsigned char)(crc >> 8) | (crc << 8);
- crc ^= buffer[i];
- crc ^= (unsigned char)(crc & 0xff) >> 4;
- crc ^= (crc << 8) << 4;
- crc ^= ((crc & 0xff) << 4) << 1;
- }
- return crc;
-} /* CalcCrcCcitt */
-#endif /* 0 */
-
/* -------------------------------------------------------------------------
* Function : GenerateCrc32Table
* Description: Generate the table of CRC remainders for all possible bytes,
diff --git a/lib/dot_draw/src/olsrd_dot_draw.c b/lib/dot_draw/src/olsrd_dot_draw.c
index decfdc6..b6a7392 100644
--- a/lib/dot_draw/src/olsrd_dot_draw.c
+++ b/lib/dot_draw/src/olsrd_dot_draw.c
@@ -239,9 +239,6 @@ plugin_ipc_init(void)
}
/* Register with olsrd */
-#if 0
- printf("Adding socket with olsrd\n");
-#endif /* 0 */
add_olsr_socket(ipc_socket, &ipc_action, NULL, NULL, SP_PR_READ);
return 1;
diff --git a/lib/httpinfo/src/admin_interface.c b/lib/httpinfo/src/admin_interface.c
index 614d8fb..9815dcc 100644
--- a/lib/httpinfo/src/admin_interface.c
+++ b/lib/httpinfo/src/admin_interface.c
@@ -54,11 +54,6 @@
#include <string.h>
#include <stdlib.h>
-#if 0
-#define sprintf netsprintf
-#define NETDIRECT
-#endif /* 0 */
-
static const char admin_basic_setting_int[] =
"<td><strong>%s</strong></td><td><input type=\"text\" name=\"%s\" maxlength=\"%d\" class=\"input_text\" value=\"%d\"></td>\n";
static const char admin_basic_setting_float[] =
@@ -325,11 +320,6 @@ process_param(char *key, char *value)
}
return 0;
-#if 0
- {
- 1, admin_basic_setting_string, "TOS:", "tos", 6, "TBD"}
- ,
-#endif /* 0 */
}
int
diff --git a/lib/httpinfo/src/olsrd_httpinfo.c b/lib/httpinfo/src/olsrd_httpinfo.c
index 8a3dde1..76671c7 100644
--- a/lib/httpinfo/src/olsrd_httpinfo.c
+++ b/lib/httpinfo/src/olsrd_httpinfo.c
@@ -214,14 +214,6 @@ static int outbuffer_count;
static struct timer_entry *writetimer_entry;
-#if 0
-int netsprintf(char *str, const char *format, ...) __attribute__ ((format(printf, 2, 3)));
-static int netsprintf_direct = 0;
-static int netsprintf_error = 0;
-#define sprintf netsprintf
-#define NETDIRECT
-#endif /* 0 */
-
static const struct tab_entry tab_entries[] = {
{"Configuration", "config", build_config_body, true},
{"Routes", "routes", build_routes_body, true},
@@ -1497,10 +1489,6 @@ build_cfgfile_body(struct autobuf *abuf)
olsrd_write_cnf_autobuf(abuf, olsr_cnf);
abuf_puts(abuf, "</pre>\n<hr/>\n");
-
-#if 0
- printf("RETURNING %d\n", size);
-#endif /* 0 */
}
static int
diff --git a/lib/httpinfo/src/olsrd_httpinfo.h b/lib/httpinfo/src/olsrd_httpinfo.h
index 31c2e64..8aef670 100644
--- a/lib/httpinfo/src/olsrd_httpinfo.h
+++ b/lib/httpinfo/src/olsrd_httpinfo.h
@@ -79,10 +79,6 @@ extern union olsr_ip_addr httpinfo_listen_ip;
void olsr_plugin_exit(void);
void olsr_plugin_exit(void);
-#if 0
-extern int netsprintf(char *str, const char *format, ...);
-#endif /* 0 */
-
#endif /* _OLSRD_HTTP_INFO */
/*
diff --git a/lib/p2pd/src/PacketHistory.c b/lib/p2pd/src/PacketHistory.c
index 57f1448..6daf67b 100644
--- a/lib/p2pd/src/PacketHistory.c
+++ b/lib/p2pd/src/PacketHistory.c
@@ -59,37 +59,6 @@ static struct TDupEntry* PacketHistory[HISTORY_HASH_SIZE];
#define CRC_UPTO_NBYTES 256
-#if 0
-/* -------------------------------------------------------------------------
- * Function : CalcCrcCcitt
- * Description: Calculate 16-bits CRC according to CRC-CCITT specification
- * Input : buffer - the bytes to calculate the CRC value over
- * len - the number of bytes to calculate the CRC value over
- * Output : none
- * Return : CRC-16 value
- * Data Used : none
- * ------------------------------------------------------------------------- */
-static u_int16_t CalcCrcCcitt(unsigned char* buffer, ssize_t len)
-{
- /* Initial value of 0xFFFF should be 0x1D0F according to
- * www.joegeluso.com/software/articles/ccitt.htm */
- u_int16_t crc = 0xFFFF;
- int i;
-
- assert(buffer != NULL);
-
- for (i = 0; i < len; i++)
- {
- crc = (unsigned char)(crc >> 8) | (crc << 8);
- crc ^= buffer[i];
- crc ^= (unsigned char)(crc & 0xff) >> 4;
- crc ^= (crc << 8) << 4;
- crc ^= ((crc & 0xff) << 4) << 1;
- }
- return crc;
-} /* CalcCrcCcitt */
-#endif /* 0 */
-
/* -------------------------------------------------------------------------
* Function : GenerateCrc32Table
* Description: Generate the table of CRC remainders for all possible bytes,
diff --git a/lib/secure/src/md5.c b/lib/secure/src/md5.c
index 46449d7..9be928e 100644
--- a/lib/secure/src/md5.c
+++ b/lib/secure/src/md5.c
@@ -88,33 +88,8 @@ static const unsigned char PADDING[64] = {
(a) += (b); \
}
-#if 0
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-static void
-MD5_memcpy(POINTER output, POINTER input, unsigned int len)
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- output[i] = input[i];
-}
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void
-MD5_memset(POINTER output, int value, unsigned int len)
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
-}
-#else /* 0 */
#define MD5_memcpy(dst, src, len) memcpy((dst), (src), (len))
#define MD5_memset(dst, val, len) memset((dst), (val), (len))
-#endif /* 0 */
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
a multiple of 4.
diff --git a/lib/secure/src/olsrd_secure.c b/lib/secure/src/olsrd_secure.c
index 924b269..fdaf1e1 100644
--- a/lib/secure/src/olsrd_secure.c
+++ b/lib/secure/src/olsrd_secure.c
@@ -137,9 +137,6 @@ char keyfile[FILENAME_MAX + 1];
char aes_key[16];
/* Event function to register with the sceduler */
-#if 0
-static void olsr_event(void);
-#endif /* 0 */
static int send_challenge(struct interface *olsr_if, const union olsr_ip_addr *);
static int send_cres(struct interface *olsr_if, union olsr_ip_addr *, union olsr_ip_addr *, uint32_t, struct stamp *);
static int send_rres(struct interface *olsr_if, union olsr_ip_addr *, union olsr_ip_addr *, uint32_t);
@@ -147,9 +144,6 @@ static int parse_challenge(struct interface *olsr_if, char *);
static int parse_cres(struct interface *olsr_if, char *);
static int parse_rres(char *);
static int check_auth(struct interface *olsr_if, char *, int *);
-#if 0
-static int ipc_send(char *, int);
-#endif /* 0 */
static int add_signature(uint8_t *, int *);
static int validate_packet(struct interface *olsr_if, const char *, int *);
static char *secure_preprocessor(char *packet, struct interface *olsr_if, union olsr_ip_addr *from_addr, int *length);
@@ -217,26 +211,6 @@ secure_plugin_exit(void)
olsr_preprocessor_remove_function(&secure_preprocessor);
}
-#if 0
-
-/**
- *Scheduled event
- */
-static void
-olsr_event(void)
-{
-
-}
-#endif /* 0 */
-
-#if 0
-static int
-ipc_send(char *data __attribute__ ((unused)), int size __attribute__ ((unused)))
-{
- return 1;
-}
-#endif /* 0 */
-
static char *
secure_preprocessor(char *packet, struct interface *olsr_if, union olsr_ip_addr *from_addr, int *length)
{
diff --git a/lib/tas/src/plugin.c b/lib/tas/src/plugin.c
index 1b11218..171c0ed 100644
--- a/lib/tas/src/plugin.c
+++ b/lib/tas/src/plugin.c
@@ -86,13 +86,6 @@ static struct hna_entry *hnaTab = NULL;
static struct olsrd_config *config = NULL;
static int iterIndex;
-#if 0
-
-/* not used */
-static struct interface *iterIntTab = NULL;
-static struct mid_entry *iterMidTab = NULL;
-static struct hna_entry *iterHnaTab = NULL;
-#endif /* 0 */
static struct link_entry *iterLinkTab = NULL;
static struct neighbor_entry *iterNeighTab = NULL;
diff --git a/src/bsd/net.c b/src/bsd/net.c
index e9c8761..e164350 100644
--- a/src/bsd/net.c
+++ b/src/bsd/net.c
@@ -120,11 +120,6 @@
#include <libnet.h>
#endif /* SPOOF */
-#if 0
-#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */
-#define SIOCGWAVELAN SIOCGIFGENERIC
-#endif /* 0 */
-
#include <sys/sysctl.h>
static int ignore_redir;
@@ -790,20 +785,6 @@ calculate_if_metric(char *ifname)
return 1;
} else {
/* Ethernet */
-#if 0
- /* Andreas: Perhaps SIOCGIFMEDIA is the way to do this? */
- struct ifmediareq ifm;
-
- memset(&ifm, 0, sizeof(ifm));
- strscpy(ifm.ifm_name, ifname, sizeof(ifm.ifm_name));
-
- if (ioctl(olsr_cnf->ioctl_s, SIOCGIFMEDIA, &ifm) < 0) {
- OLSR_PRINTF(1, "Error SIOCGIFMEDIA(%s)\n", ifm.ifm_name);
- return WEIGHT_ETHERNET_DEFAULT;
- }
-
- OLSR_PRINTF(1, "%s: STATUS 0x%08x\n", ifm.ifm_name, ifm.ifm_status);
-#endif /* 0 */
return WEIGHT_ETHERNET_DEFAULT;
}
}
diff --git a/src/build_msg.c b/src/build_msg.c
index 05e39e7..0401759 100644
--- a/src/build_msg.c
+++ b/src/build_msg.c
@@ -1162,9 +1162,6 @@ serialize_hna6(struct interface *ifp)
m->v6.seqno = htons(get_msg_seqno());
net_outbuffer_push(ifp, msg_buffer, curr_size);
-#if 0
- printf("Sending HNA (%d bytes)...\n", outputsize);
-#endif /* 0 */
return false;
}
diff --git a/src/common/avl.c b/src/common/avl.c
index 27bb82d..55080f7 100644
--- a/src/common/avl.c
+++ b/src/common/avl.c
@@ -469,17 +469,6 @@ avl_local_min(struct avl_node *node)
return node;
}
-#if 0
-static struct avl_node *
-avl_local_max(struct avl_node *node)
-{
- while (node->right != NULL)
- node = node->right;
-
- return node;
-}
-#endif /* 0 */
-
static void
avl_delete_worker(struct avl_tree *tree, struct avl_node *node)
{
diff --git a/src/defs.h b/src/defs.h
index e74457e..d4a0c46 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -197,10 +197,6 @@ extern bool olsr_win32_end_flag;
int ipc_init(void);
-#if 0
-int ipc_input(int);
-#endif /* 0 */
-
int shutdown_ipc(void);
int ipc_output(struct olsr *);
diff --git a/src/fpm.c b/src/fpm.c
index 94423b1..86d730e 100644
--- a/src/fpm.c
+++ b/src/fpm.c
@@ -146,26 +146,6 @@ fpmidiv(fpm a, int b)
return r;
}
-#if 0
-fpm
-fpmlmul(fpm a, fpm b)
-{
- fpm r;
- assert((0 < (sfpm) a) != (0 < (sfpm) b) || ((double)(sfpm) a * (double)(sfpm) b / FPM_NUM) <= (double)FPM_INT_MAX);
- assert((0 < (sfpm) a) == (0 < (sfpm) b) || ((double)(sfpm) a * (double)(sfpm) b / FPM_NUM) >= (double)FPM_INT_MIN);
- r = (fpm) fpmlmul_def((sfpm) a, (sfpm) b);
- return r;
-}
-
-fpm
-fpmldiv(fpm a, fpm b)
-{
- fpm r;
- r = (fpm) fpmldiv_def((sfpm) a, (sfpm) b);
- return r;
-}
-#endif /* 0 */
-
#endif /* NDEBUG */
fpm
diff --git a/src/fpm.h b/src/fpm.h
index fbf1e04..46f7d3b 100644
--- a/src/fpm.h
+++ b/src/fpm.h
@@ -44,29 +44,6 @@
#ifdef USE_FPM
-#if 0
-
-/*
- * Use this to find implicit number conversions when compiling
- * Note: comparing pointers is unsigned, so do not use to run.
- */
-typedef void *fpm;
-typedef signed long sfpm;
-typedef unsigned long ufpm;
-#define FPM_BIT 12
-
-#elif 0
-
-/*
- * Use this for extra long 64 bit calculations
- */
-typedef long long fpm;
-typedef signed long long sfpm;
-typedef unsigned long long ufpm;
-#define FPM_BIT 24
-
-#else /* 0 */
-
/*
* The standard math should function with only 32 bits
*/
@@ -75,8 +52,6 @@ typedef signed long sfpm;
typedef unsigned long ufpm;
#define FPM_BIT 10
-#endif /* 0 */
-
#define FPM_NUM (1 << FPM_BIT)
#define FPM_MSK (FPM_NUM - 1)
#define FPM_MAX ((sfpm)(~(ufpm)0 >> 1) >> FPM_BIT)
@@ -105,15 +80,6 @@ typedef unsigned long ufpm;
*/
#define fpmidiv_def(a, b) (fpm)((sfpm)(a) / (int)(b))
-#if 0
-
-/*
- * Special: uses long long for larger numbers, currently unused
- */
-#define fpmlmul_def(a, b) (sfpm)(((long long)(a) * (b)) >> FPM_BIT)
-#define fpmldiv_def(a, b) (sfpm)(((long long)(a) << FPM_BIT) / (b))
-#endif /* 0 */
-
#ifdef NDEBUG
#define itofpm itofpm_def
@@ -129,11 +95,6 @@ typedef unsigned long ufpm;
#define fpmmuli fpmmuli_def
#define fpmidiv fpmidiv_def
-#if 0
-#define fpmlmul fpmlmul_def
-#define fpmldiv fpmldiv_def
-#endif /* 0 */
-
#else /* NDEBUG */
fpm itofpm(sfpm i);
@@ -149,11 +110,6 @@ fpm fpmimul(int a, fpm b);
fpm fpmmuli(fpm a, int b);
fpm fpmidiv(fpm a, int b);
-#if 0
-fpm fpmlmul(fpm a, fpm b);
-fpm fpmldiv(fpm a, fpm b);
-#endif /* 0 */
-
#endif /* NDEBUG */
#define INFINITE_ETX itofpm(FPM_MAX)
diff --git a/src/hna_set.c b/src/hna_set.c
index 9ac2659..33280fe 100644
--- a/src/hna_set.c
+++ b/src/hna_set.c
@@ -128,9 +128,6 @@ olsr_lookup_hna_gw(const union olsr_ip_addr *gw)
struct hna_entry *tmp_hna;
uint32_t hash = olsr_ip_hashing(gw);
-#if 0
- OLSR_PRINTF(5, "HNA: lookup entry\n");
-#endif /* 0 */
/* Check for registered entry */
for (tmp_hna = hna_set[hash].next; tmp_hna != &hna_set[hash]; tmp_hna = tmp_hna->next) {
diff --git a/src/interfaces.c b/src/interfaces.c
index f84fd6d..832e1c1 100644
--- a/src/interfaces.c
+++ b/src/interfaces.c
@@ -399,22 +399,6 @@ olsr_remove_interface(struct olsr_if * iface)
/* Remove output buffer */
net_remove_buffer(ifp);
- /* Check main addr */
- /* deactivated to prevent change of originator IP */
-#if 0
- if (ipequal(&olsr_cnf->main_addr, &ifp->ip_addr)) {
- if (ifnet == NULL) {
- /* No more interfaces */
- memset(&olsr_cnf->main_addr, 0, olsr_cnf->ipsize);
- OLSR_PRINTF(1, "No more interfaces...\n");
- } else {
- struct ipaddr_str buf;
- olsr_cnf->main_addr = ifnet->ip_addr;
- OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
- olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
- }
- }
-#endif /* 0 */
/*
* Deregister functions for periodic message generation
*/
diff --git a/src/ipc_frontend.c b/src/ipc_frontend.c
index 8dd1ab6..620807f 100644
--- a/src/ipc_frontend.c
+++ b/src/ipc_frontend.c
@@ -179,31 +179,6 @@ ipc_check_allowed_ip(const union olsr_ip_addr *addr)
return false;
}
-#if 0
-
-/**
- *Read input from the IPC socket. Not in use.
- *
- *@todo for future use
- *@param sock the IPC socket
- *@return 1
- */
-int
-ipc_input(int sock __attribute__ ((unused)))
-{
- union {
- char buf[MAXPACKETSIZE + 1];
- struct olsr olsr;
- } inbuf;
-
- if (recv(sock, dir, sizeof(dir), 0) == -1) {
- perror("recv");
- exit(1);
- }
- return 1;
-}
-#endif /* 0 */
-
/**
*Sends a olsr packet on the IPC socket.
*
diff --git a/src/linux/kernel_routes_nl.c b/src/linux/kernel_routes_nl.c
index cf5fe86..44c619d 100644
--- a/src/linux/kernel_routes_nl.c
+++ b/src/linux/kernel_routes_nl.c
@@ -513,17 +513,6 @@ static int olsr_os_process_rt_entry(int af_family, const struct rt_entry *rt, bo
hostRoute = rt->rt_dst.prefix_len == olsr_cnf->ipsize * 8
&& ipequal(&nexthop->gateway, &rt->rt_dst.prefix);
-#if 0
- {
- struct ipaddr_str buf1, buf2;
- olsr_syslog(OLSR_LOG_INFO, "hostroute (%s) = %d == %d && %s == %s",
- hostRoute ? "true" : "false",
- rt->rt_dst.prefix_len, (int)(olsr_cnf->ipsize * 8),
- olsr_ip_to_string(&buf1, &nexthop->gateway),
- olsr_ip_to_string(&buf2, &rt->rt_dst.prefix));
- }
-#endif /* 0 */
-
/* get src ip */
if (olsr_cnf->use_src_ip_routes) {
src = &olsr_cnf->unicast_src_ip;
diff --git a/src/linux/link_layer.c b/src/linux/link_layer.c
deleted file mode 100644
index 6e502aa..0000000
--- a/src/linux/link_layer.c
+++ /dev/null
@@ -1,378 +0,0 @@
-
-/*
- * The olsr.org Optimized Link-State Routing daemon(olsrd)
- * Copyright (c) 2004, Andreas Tonnesen((spam-protected))
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of olsr.org, olsrd nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * Visit http://www.olsr.org for more information.
- *
- * If you find this software useful feel free to make a donation
- * to the project. For more information see the website or contact
- * the copyright holders.
- *
- */
-
-#if 0 /* DEPRECATED - KEPT FOR REFERENCE */
-
-/* Ugly fix to make this compile on wireless extentions < 16 */
-#define _LINUX_ETHTOOL_H
-
-#include "../link_layer.h"
-#include "../olsr_protocol.h"
-#include "../scheduler.h"
-#include "../interfaces.h"
-#include <linux/wireless.h>
-#include <linux/icmp.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <net/if_arp.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "olsr_protocol.h"
-
-void init_link_layer_notification(void);
-
-void poll_link_layer(void *);
-
-int add_spy_node(union olsr_ip_addr *, char *);
-
-#define MAXIPLEN 60
-#define MAXICMPLEN 76
-
-float poll_int = 200; /* msec */
-
-int iw_get_range_info(char *, struct iw_range *);
-
-int clear_spy_list(char *);
-
-int convert_ip_to_mac(union olsr_ip_addr *, struct sockaddr *, char *);
-
-void send_ping(union olsr_ip_addr *);
-
-void
-init_link_layer_notification()
-{
- struct interface *ifd;
-
- OLSR_PRINTF(1, "Initializing link-layer notification...\n");
-
- for (ifd = ifnet; ifd; ifd = ifd->int_next) {
- if (ifd->is_wireless)
- clear_spy_list(ifd->int_name);
- }
-
- olsr_start_timer(poll_int, 0, OLSR_TIMER_PERIODIC, &poll_link_layer, NULL, 0);
-
- return;
-}
-
-int
-clear_spy_list(char *ifname)
-{
- struct iwreq wrq;
-
- /* Time to do send addresses to the driver */
- wrq.u.data.pointer = NULL; //(caddr_t) hw_address;
- wrq.u.data.length = 0;
- wrq.u.data.flags = 0;
-
- /* Set device name */
- strscpy(wrq.ifr_name, ifname, sizeof(wrq.ifr_name));
-
- if (ioctl(olsr_cnf->ioctl_s, SIOCSIWSPY, &wrq) < 0) {
- OLSR_PRINTF(1, "Could not clear spylist %s\n", strerror(errno));
- return -1;
- }
-
- return 1;
-}
-
-int
-add_spy_node(union olsr_ip_addr *addr, char *interface)
-{
- struct sockaddr new_node;
- struct iwreq wrq;
- int nbr; /* Number of valid addresses */
- struct sockaddr hw_address[IW_MAX_SPY];
- char buffer[(sizeof(struct iw_quality) + sizeof(struct sockaddr)) * IW_MAX_SPY];
-
- OLSR_PRINTF(1, "Adding spynode!\n\n");
-
- /* get all addresses already in the driver */
-
- wrq.u.data.pointer = (caddr_t) buffer;
- wrq.u.data.length = IW_MAX_SPY;
- wrq.u.data.flags = 0;
-
- strscpy(wrq.ifr_name, interface, sizeof(wrq.ifr_name));
-
- if (ioctl(olsr_cnf->ioctl_s, SIOCGIWSPY, &wrq) < 0) {
- OLSR_PRINTF(1, "Could not get old spylist %s\n", strerror(errno));
- return 0;
- }
-
- /* Copy old addresses */
- nbr = wrq.u.data.length;
- memcpy(hw_address, buffer, nbr * sizeof(struct sockaddr));
-
- OLSR_PRINTF(1, "Old addresses: %d\n\n", nbr);
-
- /* Check upper limit */
- if (nbr >= IW_MAX_SPY)
- return 0;
-
- /* Add new address if MAC exists in ARP cache */
- if (convert_ip_to_mac(addr, &new_node, interface) > 0) {
- memcpy(&hw_address[nbr], &new_node, sizeof(struct sockaddr));
- nbr++;
- } else
- return 0;
-
- /* Add all addresses */
- wrq.u.data.pointer = (caddr_t) hw_address;
- wrq.u.data.length = nbr;
- wrq.u.data.flags = 0;
-
- /* Set device name */
- strscpy(wrq.ifr_name, interface, sizeof(wrq.ifr_name));
-
- if (ioctl(olsr_cnf->ioctl_s, SIOCSIWSPY, &wrq) < 0) {
- OLSR_PRINTF(1, "Could not clear spylist %s\n", strerror(errno));
- return 0;
- }
-
- return 1;
-}
-
-int
-convert_ip_to_mac(union olsr_ip_addr *ip, struct sockaddr *mac, char *interface)
-{
- struct arpreq arp_query;
- struct sockaddr_in tmp_sockaddr;
-
- memset(&arp_query, 0, sizeof(struct arpreq));
-
- OLSR_PRINTF(1, "\nARP conversion for %s interface %s\n", olsr_ip_to_string(ip), interface);
-
- tmp_sockaddr.sin_family = AF_INET;
- tmp_sockaddr.sin_port = 0;
-
- memcpy(&tmp_sockaddr.sin_addr, ip, olsr_cnf->ipsize);
-
- /* Translate IP addresses to MAC addresses */
- memcpy(&arp_query.arp_pa, &tmp_sockaddr, sizeof(struct sockaddr_in));
- arp_query.arp_ha.sa_family = 0;
- arp_query.arp_flags = 0;
-
- strscpy(arp_query.arp_dev, interface, sizeof(arp_query.arp_dev));
-
- if ((ioctl(olsr_cnf->ioctl_s, SIOCGARP, &arp_query) < 0) || !(arp_query.arp_flags & ATF_COM)) { /* ATF_COM - hw addr valid */
- OLSR_PRINTF(1, "Arp failed: (%s) - trying lookup\n", strerror(errno));
-
- /* No address - create a thread that sends a PING */
- send_ping(ip);
-
- return -1;
- }
-
- OLSR_PRINTF(1, "Arp success!\n");
-
- memcpy(mac, &arp_query.arp_ha, sizeof(struct sockaddr));
-
- return 1;
-}
-
-/**
- *A thread that sends a ICMP echo "ping" packet
- *to a given destination to force the ARP cache
- *to be updated... kind of a kludge....
- *
- *@param _ip the IP address to ping
- */
-
-/* ONLY IPv4 FOR NOW!!! */
-
-void
-send_ping(union olsr_ip_addr *ip)
-{
- int ping_s;
- struct sockaddr dst;
- struct sockaddr_in *dst_in;
- char *packet;
- struct icmphdr *icp;
-
- dst_in = (struct sockaddr_in *)&dst;
-
- dst_in->sin_family = AF_INET;
- memcpy(&dst_in->sin_addr, ip, olsr_cnf->ipsize);
-
- OLSR_PRINTF(1, "pinging %s\n\n", olsr_ip_to_string(ip));
-
- if ((ping_s = socket(AF_INET, SOCK_RAW, PF_INET)) < 0) {
- OLSR_PRINTF(1, "Could not create RAW socket for ping!\n%s\n", strerror(errno));
- return;
- }
-
- /* Create packet */
- packet = malloc(MAXIPLEN + MAXICMPLEN);
-
- icp = (struct icmphdr *)packet;
- icp->type = ICMP_ECHO;
- icp->code = 0;
- icp->checksum = 0;
- icp->un.echo.sequence = 1;
- icp->un.echo.id = getpid() & 0xFFFF;
-
- if ((sendto(ping_s, packet, MAXIPLEN + MAXICMPLEN + 8, 0, &dst, sizeof(struct sockaddr))) != MAXIPLEN + MAXICMPLEN + 8) {
- OLSR_PRINTF(1, "Error PING: %s\n", strerror(errno));
- }
-
- /* Nevermind the pong ;-) */
-
- OLSR_PRINTF(1, "Ping complete...\n");
- close(ping_s);
-
- free(packet);
-
- return;
-}
-
-void
-poll_link_layer(void *foo)
-{
- struct iwreq wrq;
- char buffer[(sizeof(struct iw_quality) + sizeof(struct sockaddr)) * IW_MAX_SPY];
- struct sockaddr *hwa;
- struct iw_quality *qual;
- int n;
- struct iw_range range;
- int i, j;
- int has_range = 0;
- struct interface *iflist;
-
- //OLSR_PRINTF(1, "Polling link-layer notification...\n");
-
- for (iflist = ifnet; iflist != NULL; iflist = iflist->int_next) {
- if (!iflist->is_wireless)
- continue;
-
- /* Collect stats */
- wrq.u.data.pointer = (caddr_t) buffer;
- wrq.u.data.length = IW_MAX_SPY;
- wrq.u.data.flags = 0;
-
- /* Set device name */
- strscpy(wrq.ifr_name, iflist->int_name, sizeof(wrq.ifr_name));
-
- /* Do the request */
- if (ioctl(olsr_cnf->ioctl_s, SIOCGIWSPY, &wrq) < 0) {
- OLSR_PRINTF(1, "%-8.16s Interface doesn't support wireless statistic collection\n\n", iflist->int_name);
- return;
- }
-
- /* Get range info if we can */
- if (iw_get_range_info(iflist->int_name, &(range)) >= 0)
- has_range = 1;
-
- /* Number of addresses */
- n = wrq.u.data.length;
-
- /* The two lists */
- hwa = (struct sockaddr *)buffer;
- qual = (struct iw_quality *)(buffer + (sizeof(struct sockaddr) * n));
-
- for (i = 0; i < n; i++) {
- if (!(qual->updated & 0x7))
- continue;
-
- /* Print stats for each address */
- OLSR_PRINTF(1, "MAC");
- for (j = 0; j < 6; j++) {
- OLSR_PRINTF(1, ":%02x", (hwa[i].sa_data[j] % 0xffffff00));
- }
- if (!has_range)
- OLSR_PRINTF(1, " : Quality:%d Signal level:%d dBm Noise level:%d dBm", qual[i].qual, qual[i].level - 0x100,
- qual[i].noise - 0x100);
- else
- OLSR_PRINTF(1, " : Quality:%d/%d Signal level:%d dBm Noise level:%d dBm", qual[i].qual, range.max_qual.qual,
- qual[i].level - 0x100, qual[i].noise - 0x100);
-
- OLSR_PRINTF(1, "\n");
-
- }
- }
-
- //OLSR_PRINTF(1, "\n");
- return;
-}
-
-/*
- * Get the range information out of the driver
- */
-int
-iw_get_range_info(char *ifname, struct iw_range *range)
-{
- struct iwreq wrq;
- char buffer[sizeof(struct iw_range) * 2]; /* Large enough */
- union iw_range_raw *range_raw;
-
- /* Cleanup */
- bzero(buffer, sizeof(buffer));
-
- wrq.u.data.pointer = (caddr_t) buffer;
- wrq.u.data.length = sizeof(buffer);
- wrq.u.data.flags = 0;
-
- /* Set device name */
- strscpy(wrq.ifr_name, ifname, sizeof(wrq.ifr_name));
-
- if (ioctl(olsr_cnf->ioctl_s, SIOCGIWRANGE, &wrq) < 0) {
- OLSR_PRINTF(1, "NO RANGE\n");
- return -1;
- }
-
- /* Point to the buffer */
- range_raw = (union iw_range_raw *)buffer;
-
- memcpy((char *)range, buffer, sizeof(struct iw_range));
-
- return 1;
-}
-
-#endif /* 0 */
-
-/*
- * Local Variables:
- * c-basic-offset: 2
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/src/linux/net.c b/src/linux/net.c
index 867a44b..82653aa 100644
--- a/src/linux/net.c
+++ b/src/linux/net.c
@@ -106,9 +106,6 @@ static char orig_fwd_state;
static char orig_global_redirect_state;
static char orig_global_rp_filter;
static char orig_tunnel_rp_filter;
-#if 0 // should not be necessary for IPv6 */
-static char orig_tunnel6_rp_filter;
-#endif /* 0 */
/**
*Bind a socket to a device
@@ -242,18 +239,6 @@ net_os_set_global_ifoptions(void) {
olsr_startup_sleep(3);
}
}
-
-#if 0 // should not be necessary for IPv6
- if (olsr_cnf->ip_version == AF_INET6) {
- snprintf(procfile, sizeof(procfile), PROC_IF_SPOOF, TUNNEL_ENDPOINT_IF6);
- if (writeToProc(procfile, &orig_tunnel6_rp_filter, OLSRD_SPOOF_VALUE)) {
- OLSR_PRINTF(0, "WARNING! Could not disable the IP spoof filter for tunnel6!\n"
- "you should manually ensure that IP spoof filtering is disabled!\n\n");
-
- olsr_startup_sleep(3);
- }
- }
-#endif /* 0 */
}
if (olsr_cnf->ip_version == AF_INET) {
@@ -335,15 +320,6 @@ net_os_restore_ifoptions(void)
if (restoreProc(procfile, orig_tunnel_rp_filter, OLSRD_SPOOF_VALUE)) {
OLSR_PRINTF(0, "WARNING! Could not restore the IP spoof filter for tunnel!\n");
}
-
-#if 0 // should not be necessary for IPv6
- if (olsr_cnf->ip_version == AF_INET6) {
- snprintf(procfile, sizeof(procfile), PROC_IF_SPOOF, TUNNEL_ENDPOINT_IF6);
- if (restoreProc(procfile, orig_tunnel6_rp_filter, OLSRD_SPOOF_VALUE)) {
- OLSR_PRINTF(0, "WARNING! Could not restore the IP spoof filter for tunnel6!\n");
- }
- }
-#endif /* 0 */
}
if (olsr_cnf->ip_version == AF_INET) {
@@ -724,142 +700,11 @@ check_wireless_interface(char *ifname)
return (ioctl(olsr_cnf->ioctl_s, SIOCGIWNAME, &ifr) >= 0) ? 1 : 0;
}
-#if 0
-
-#include <linux/sockios.h>
-#include <linux/types.h>
-
-/* This data structure is used for all the MII ioctl's */
-struct mii_data {
- __u16 phy_id;
- __u16 reg_num;
- __u16 val_in;
- __u16 val_out;
-};
-
-/* Basic Mode Control Register */
-#define MII_BMCR 0x00
-#define MII_BMCR_RESET 0x8000
-#define MII_BMCR_LOOPBACK 0x4000
-#define MII_BMCR_100MBIT 0x2000
-#define MII_BMCR_AN_ENA 0x1000
-#define MII_BMCR_ISOLATE 0x0400
-#define MII_BMCR_RESTART 0x0200
-#define MII_BMCR_DUPLEX 0x0100
-#define MII_BMCR_COLTEST 0x0080
-
-/* Basic Mode Status Register */
-#define MII_BMSR 0x01
-#define MII_BMSR_CAP_MASK 0xf800
-#define MII_BMSR_100BASET4 0x8000
-#define MII_BMSR_100BASETX_FD 0x4000
-#define MII_BMSR_100BASETX_HD 0x2000
-#define MII_BMSR_10BASET_FD 0x1000
-#define MII_BMSR_10BASET_HD 0x0800
-#define MII_BMSR_NO_PREAMBLE 0x0040
-#define MII_BMSR_AN_COMPLETE 0x0020
-#define MII_BMSR_REMOTE_FAULT 0x0010
-#define MII_BMSR_AN_ABLE 0x0008
-#define MII_BMSR_LINK_VALID 0x0004
-#define MII_BMSR_JABBER 0x0002
-#define MII_BMSR_EXT_CAP 0x0001
-
-int
-calculate_if_metric(char *ifname)
-{
- if (check_wireless_interface(ifname)) {
- struct ifreq ifr;
- strscpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-
- /* Get bit rate */
- if (ioctl(olsr_cnf->ioctl_s, SIOCGIWRATE, &ifr) < 0) {
- OLSR_PRINTF(1, "Not able to find rate for WLAN interface %s\n", ifname);
- return WEIGHT_WLAN_11MB;
- }
-
- OLSR_PRINTF(1, "Bitrate %d\n", ifr.ifr_ifru.ifru_ivalue);
-
- //WEIGHT_WLAN_LOW, /* <11Mb WLAN */
- //WEIGHT_WLAN_11MB, /* 11Mb 802.11b */
- //WEIGHT_WLAN_54MB, /* 54Mb 802.11g */
- return WEIGHT_WLAN_LOW;
- } else {
- /* Ethernet */
- /* Mii wizardry */
- struct ifreq ifr;
- struct mii_data *mii = (struct mii_data *)&ifr.ifr_data;
- int bmcr;
- memset(&ifr, 0, sizeof(ifr));
- strscpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-
- if (ioctl(olsr_cnf->ioctl_s, SIOCGMIIPHY, &ifr) < 0) {
- if (errno != ENODEV)
- OLSR_PRINTF(1, "SIOCGMIIPHY on '%s' failed: %s\n", ifr.ifr_name, strerror(errno));
- return WEIGHT_ETHERNET_DEFAULT;
- }
-
- mii->reg_num = MII_BMCR;
- if (ioctl(olsr_cnf->ioctl_s, SIOCGMIIREG, &ifr) < 0) {
- OLSR_PRINTF(1, "SIOCGMIIREG on %s failed: %s\n", ifr.ifr_name, strerror(errno));
- return WEIGHT_ETHERNET_DEFAULT;
- }
- bmcr = mii->val_out;
-
- OLSR_PRINTF(1, "%s: ", ifr.ifr_name);
- OLSR_PRINTF(1, "%s Mbit, %s duplex\n", (bmcr & MII_BMCR_100MBIT) ? "100" : "10", (bmcr & MII_BMCR_DUPLEX) ? "full" : "half");
-
- is_if_link_up(ifname);
-
- if (mii->val_out & MII_BMCR_100MBIT)
- return WEIGHT_ETHERNET_100MB;
- else
- return WEIGHT_ETHERNET_10MB;
- //WEIGHT_ETHERNET_1GB, /* Ethernet 1Gb */
-
- }
-}
-
-bool
-is_if_link_up(char *ifname)
-{
- if (check_wireless_interface(ifname)) {
- /* No link checking on wireless devices */
- return true;
- } else {
- /* Mii wizardry */
- struct ifreq ifr;
- struct mii_data *mii = (struct mii_data *)&ifr.ifr_data;
- int bmsr;
- memset(&ifr, 0, sizeof(ifr));
- strscpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-
- if (ioctl(olsr_cnf->ioctl_s, SIOCGMIIPHY, &ifr) < 0) {
- if (errno != ENODEV)
- OLSR_PRINTF(1, "SIOCGMIIPHY on '%s' failed: %s\n", ifr.ifr_name, strerror(errno));
- return WEIGHT_ETHERNET_DEFAULT;
- }
- mii->reg_num = MII_BMSR;
- if (ioctl(olsr_cnf->ioctl_s, SIOCGMIIREG, &ifr) < 0) {
- OLSR_PRINTF(1, "SIOCGMIIREG on %s failed: %s\n", ifr.ifr_name, strerror(errno));
- return WEIGHT_ETHERNET_DEFAULT;
- }
- bmsr = mii->val_out;
-
- OLSR_PRINTF(1, "%s: ", ifr.ifr_name);
- OLSR_PRINTF(1, "%s\n", (bmsr & MII_BMSR_LINK_VALID) ? "link ok " : "no link ");
-
- return (bmsr & MII_BMSR_LINK_VALID);
-
- }
-}
-
-#else /* 0 */
int
calculate_if_metric(char *ifname)
{
return check_wireless_interface(ifname);
}
-#endif /* 0 */
bool olsr_if_isup(const char * dev)
{
diff --git a/src/lq_plugin_default_ff.c b/src/lq_plugin_default_ff.c
index 4a7695c..56f60c9 100644
--- a/src/lq_plugin_default_ff.c
+++ b/src/lq_plugin_default_ff.c
@@ -115,12 +115,6 @@ default_lq_ff_handle_lqchange(void) {
bool relevant = false;
lq = (struct default_lq_ff_hello *)link->linkquality;
-#if 0
- fprintf(stderr, "%s: old = %u/%u new = %u/%u\n", olsr_ip_to_string(&buf, &link->neighbor_iface_addr),
- lq->smoothed_lq.valueLq, lq->smoothed_lq.valueNlq,
- lq->lq.valueLq, lq->lq.valueNlq);
-#endif /* 0 */
-
if (lq->smoothed_lq.valueLq < lq->lq.valueLq) {
if (lq->lq.valueLq == 255 || lq->lq.valueLq - lq->smoothed_lq.valueLq > lq->smoothed_lq.valueLq/10) {
relevant = true;
diff --git a/src/lq_plugin_default_ffeth.c b/src/lq_plugin_default_ffeth.c
index 4905751..966a353 100644
--- a/src/lq_plugin_default_ffeth.c
+++ b/src/lq_plugin_default_ffeth.c
@@ -117,12 +117,6 @@ default_lq_ffeth_handle_lqchange(void) {
bool relevant = false;
lq = (struct default_lq_ffeth_hello *)link->linkquality;
-#if 0
- fprintf(stderr, "%s: old = %u/%u new = %u/%u\n", olsr_ip_to_string(&buf, &link->neighbor_iface_addr),
- lq->smoothed_lq.valueLq, lq->smoothed_lq.valueNlq,
- lq->lq.valueLq, lq->lq.valueNlq);
-#endif /* 0 */
-
if (lq->smoothed_lq.valueLq < lq->lq.valueLq) {
if (lq->lq.valueLq >= 254 || lq->lq.valueLq - lq->smoothed_lq.valueLq > lq->smoothed_lq.valueLq/10) {
relevant = true;
diff --git a/src/olsr.c b/src/olsr.c
index 6762d8a..8401436 100644
--- a/src/olsr.c
+++ b/src/olsr.c
@@ -588,10 +588,6 @@ olsr_malloc(size_t size, const char *id)
olsr_syslog(OLSR_LOG_ERR, "olsrd: out of memory!: %s\n", err_msg);
olsr_exit(id, EXIT_FAILURE);
}
-#if 0
- /* useful for debugging */
- olsr_printf(1, "MEMORY: alloc %s %p, %u bytes\n", id, ptr, size);
-#endif /* 0 */
return ptr;
}
diff --git a/src/tc_set.c b/src/tc_set.c
index dbd63c9..1f9da04 100644
--- a/src/tc_set.c
+++ b/src/tc_set.c
@@ -280,10 +280,6 @@ olsr_delete_tc_entry(struct tc_entry *tc)
{
struct tc_edge_entry *tc_edge;
struct rt_path *rtp;
-#if 0
- struct ipaddr_str buf;
- OLSR_PRINTF(1, "TC: del entry %s\n", olsr_ip_to_string(&buf, &tc->addr));
-#endif /* 0 */
/* delete gateway if available */
#ifdef __linux__
@@ -324,10 +320,6 @@ olsr_lookup_tc_entry(union olsr_ip_addr *adr)
{
struct avl_node *node;
-#if 0
- OLSR_PRINTF(1, "TC: lookup entry\n");
-#endif /* 0 */
-
node = avl_find(&tc_tree, adr);
return (node ? vertex_tree2tc(node) : NULL);
@@ -545,10 +537,6 @@ olsr_delete_outdated_tc_edges(struct tc_entry *tc)
struct tc_edge_entry *tc_edge;
bool retval = false;
-#if 0
- OLSR_PRINTF(5, "TC: deleting outdated TC-edge entries\n");
-#endif /* 0 */
-
OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
if (SEQNO_GREATER_THAN(tc->ansn, tc_edge->ansn)) {
olsr_delete_tc_edge_entry(tc_edge);
@@ -574,10 +562,6 @@ olsr_delete_revoked_tc_edges(struct tc_entry *tc, uint16_t ansn, union olsr_ip_a
struct tc_edge_entry *tc_edge;
int retval = 0;
-#if 0
- OLSR_PRINTF(5, "TC: deleting MPRS\n");
-#endif /* 0 */
-
bool passedLowerBorder = false;
OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
@@ -690,10 +674,6 @@ olsr_lookup_tc_edge(struct tc_entry *tc, union olsr_ip_addr *edge_addr)
{
struct avl_node *edge_node;
-#if 0
- OLSR_PRINTF(1, "TC: lookup dst\n");
-#endif /* 0 */
-
edge_node = avl_find(&tc->edge_tree, edge_addr);
return (edge_node ? edge_tree2tc_edge(edge_node) : NULL);
diff --git a/src/two_hop_neighbor_table.c b/src/two_hop_neighbor_table.c
index a6a9720..50f43de 100644
--- a/src/two_hop_neighbor_table.c
+++ b/src/two_hop_neighbor_table.c
@@ -134,10 +134,6 @@ olsr_insert_two_hop_neighbor_table(struct neighbor_2_entry *two_hop_neighbor)
{
uint32_t hash = olsr_ip_hashing(&two_hop_neighbor->neighbor_2_addr);
-#if 0
- printf("Adding 2 hop neighbor %s\n", olsr_ip_to_string(&buf, &two_hop_neighbor->neighbor_2_addr));
-#endif /* 0 */
-
/* Queue */
QUEUE_ELEM(two_hop_neighbortable[hash], two_hop_neighbor);
}
diff --git a/src/unix/ifnet.c b/src/unix/ifnet.c
index d9a2c18..cbb1c60 100644
--- a/src/unix/ifnet.c
+++ b/src/unix/ifnet.c
@@ -262,14 +262,6 @@ chk_if_changed(struct olsr_if *iface)
OLSR_PRINTF(1, "\tOld: %s\n", ip6_to_string(&buf, &ifp->int6_addr.sin6_addr));
OLSR_PRINTF(1, "\tNew: %s\n", ip6_to_string(&buf, &tmp_saddr6.sin6_addr));
- /* deactivated to prevent change of originator IP */
-#if 0
- /* Check main addr */
- if (memcmp(&olsr_cnf->main_addr, &tmp_saddr6.sin6_addr, olsr_cnf->ipsize) == 0) {
- /* Update main addr */
- memcpy(&olsr_cnf->main_addr, &tmp_saddr6.sin6_addr, olsr_cnf->ipsize);
- }
-#endif /* 0 */
/* Update address */
memcpy(&ifp->int6_addr.sin6_addr, &tmp_saddr6.sin6_addr, olsr_cnf->ipsize);
memcpy(&ifp->ip_addr, &tmp_saddr6.sin6_addr, olsr_cnf->ipsize);
@@ -304,14 +296,6 @@ chk_if_changed(struct olsr_if *iface)
OLSR_PRINTF(1, "\tNew:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr));
ifp->int_addr = *(struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_addr);
- /* deactivated to prevent change of originator IP */
-#if 0
- if (memcmp(&olsr_cnf->main_addr, &ifp->ip_addr, olsr_cnf->ipsize) == 0) {
- OLSR_PRINTF(1, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr));
- olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr));
- memcpy(&olsr_cnf->main_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, olsr_cnf->ipsize);
- }
-#endif /* 0 */
memcpy(&ifp->ip_addr, &((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_addr))->sin_addr.s_addr, olsr_cnf->ipsize);
/* we have to make sure that olsrd uses the new source address of this interface */
@@ -464,25 +448,6 @@ add_hemu_if(struct olsr_if *iface)
} else {
/* IP version 6 */
memcpy(&ifp->ip_addr, &iface->hemu_ip, olsr_cnf->ipsize);
-
-#if 0
- /*
- *We create one socket for each interface and bind
- *the socket to it. This to ensure that we can control
- *on what interface the message is transmitted
- */
-
- ifp->olsr_socket = gethcsocket6(&addrsock6, BUFSPACE, ifp->int_name);
-
- join_mcast(ifp, ifp->olsr_socket);
-
- if (ifp->olsr_socket < 0) {
- fprintf(stderr, "Could not initialize socket... exiting!\n\n");
- olsr_syslog(OLSR_LOG_ERR, "Could not initialize socket... exiting!\n\n");
- olsr_cnf->exit_value = EXIT_FAILURE;
- kill(getpid(), SIGINT);
- }
-#endif /* 0 */
}
/* Send IP as first 4/16 bytes on socket */
diff --git a/src/win32/ifnet.c b/src/win32/ifnet.c
index c89a447..b666dc9 100644
--- a/src/win32/ifnet.c
+++ b/src/win32/ifnet.c
@@ -552,23 +552,6 @@ add_hemu_if(struct olsr_if *iface)
} else {
/* IP version 6 */
memcpy(&ifp->ip_addr, &iface->hemu_ip, olsr_cnf->ipsize);
-
-#if 0
- /*
- *We create one socket for each interface and bind
- *the socket to it. This to ensure that we can control
- *on what interface the message is transmitted
- */
-
- ifp->olsr_socket = gethcsocket6(&addrsock6, bufspace, ifp->int_name);
-
- join_mcast(ifp, ifp->olsr_socket);
-
- if (ifp->olsr_socket < 0) {
- fprintf(stderr, "Could not initialize socket... exiting!\n\n");
- exit(1);
- }
-#endif /* 0 */
}
/* Send IP as first 4/16 bytes on socket */
diff --git a/src/win32/net.c b/src/win32/net.c
index 9589797..997faba 100644
--- a/src/win32/net.c
+++ b/src/win32/net.c
@@ -319,16 +319,6 @@ DisableIcmpRedirects(void)
fprintf(stderr, "\n*** IMPORTANT *** IMPORTANT *** IMPORTANT *** IMPORTANT *** IMPORTANT ***\n\n");
-#if 0
- if (Res < 0) {
- fprintf(stderr, "Cannot disable ICMP redirect processing in the registry.\n");
- fprintf(stderr, "Please disable it manually. Continuing in 3 seconds...\n");
- Sleep(3000);
-
- return;
- }
-#endif /* 0 */
-
fprintf(stderr, "I have disabled ICMP redirect processing in the registry for you.\n");
fprintf(stderr, "REBOOT NOW, so that these changes take effect. Exiting...\n\n");
--
1.7.11.4
More information about the Olsr-dev
mailing list