projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Prepended config_ to all configuration option names, because it confused
[tinc]
/
src
/
subnet.c
diff --git
a/src/subnet.c
b/src/subnet.c
index
215b156
..
6ca3fee
100644
(file)
--- a/
src/subnet.c
+++ b/
src/subnet.c
@@
-17,20
+17,22
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: subnet.c,v 1.1.2.
7 2000/10/28 21:05:20
guus Exp $
+ $Id: subnet.c,v 1.1.2.
11 2000/11/04 22:57:33
guus Exp $
*/
*/
-#include <syslog.h>
-
#include "config.h"
#include "config.h"
-#include <utils.h>
-#include <
xalloc
.h>
-#include
"subnet.h"
-#include "net.h"
+#include <
stdio
.h>
+#include
<syslog.h>
+
#include "conf.h"
#include "conf.h"
+#include "net.h"
+#include "subnet.h"
#include "system.h"
#include "system.h"
+#include <utils.h>
+#include <xalloc.h>
+
/* lists type of subnet */
subnet_t *subnet_list[SUBNET_TYPES] = { NULL };
/* lists type of subnet */
subnet_t *subnet_list[SUBNET_TYPES] = { NULL };
@@
-114,28
+116,22
@@
cp
/* Remove it from owner's list */
if(subnet->prev)
/* Remove it from owner's list */
if(subnet->prev)
- {
- subnet->prev->next = subnet->next;
- }
+ subnet->prev->next = subnet->next;
else
else
- {
- subnet->owner->subnets = subnet->next;
- }
+ subnet->owner->subnets = subnet->next;
- subnet->next->prev = subnet->prev;
+ if(subnet->next)
+ subnet->next->prev = subnet->prev;
/* Remove it from the global list */
if(subnet->global_prev)
/* Remove it from the global list */
if(subnet->global_prev)
- {
- subnet->global_prev->global_next = subnet->global_next;
- }
+ subnet->global_prev->global_next = subnet->global_next;
else
else
- {
- subnet_list[subnet->type] = subnet->global_next;
- }
+ subnet_list[subnet->type] = subnet->global_next;
- subnet->global_next->global_prev = subnet->global_prev;
+ if(subnet->global_next)
+ subnet->global_next->global_prev = subnet->global_prev;
free_subnet(subnet);
cp
free_subnet(subnet);
cp
@@
-225,7
+221,7
@@
cp
asprintf(&netstr, "%d,%lx/%lx", subnet->type, subnet->net.ipv4.address, subnet->net.ipv4.mask);
break;
case SUBNET_IPV6:
asprintf(&netstr, "%d,%lx/%lx", subnet->type, subnet->net.ipv4.address, subnet->net.ipv4.mask);
break;
case SUBNET_IPV6:
- asprintf(&netstr, "%d,%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx",
+ asprintf(&netstr, "%d,%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx",
subnet->type,
subnet->net.ipv6.address.x[0],
subnet->net.ipv6.address.x[1],
subnet->net.ipv6.address.x[2],
subnet->net.ipv6.address.x[0],
subnet->net.ipv6.address.x[1],
subnet->net.ipv6.address.x[2],
@@
-288,7
+284,7
@@
cp
for(i=0; i<8; i++)
if((address.x[i] & subnet->net.ipv6.mask.x[i]) != subnet->net.ipv6.address.x[i])
break;
for(i=0; i<8; i++)
if((address.x[i] & subnet->net.ipv6.mask.x[i]) != subnet->net.ipv6.address.x[i])
break;
- if(i
=
8)
+ if(i
==
8)
break;
}
cp
break;
}
cp
@@
-305,7
+301,7
@@
cp
for(subnet = subnet_list[SUBNET_IPV4]; subnet != NULL; subnet = subnet->global_next)
{
netstr = net2str(subnet);
for(subnet = subnet_list[SUBNET_IPV4]; subnet != NULL; subnet = subnet->global_next)
{
netstr = net2str(subnet);
- syslog(LOG_DEBUG, "%s owner %s", netstr, subnet->owner->name);
+ syslog(LOG_DEBUG, "
%s owner %s", netstr, subnet->owner->name);
free(netstr);
}
free(netstr);
}