aboutsummaryrefslogtreecommitdiffstats
path: root/src/libfreeswan/initsubnet.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-05-15 16:59:00 +0200
committerTobias Brunner <tobias@strongswan.org>2012-06-11 17:33:32 +0200
commitfff4b74db26968bac72ade4bd6c702be7b51ec7a (patch)
treef101045942fa34c0c93e9b828def87778feacb11 /src/libfreeswan/initsubnet.c
parent4a54860986e34f46183eebe60d7af767de7ddf25 (diff)
downloadstrongswan-fff4b74db26968bac72ade4bd6c702be7b51ec7a.tar.bz2
strongswan-fff4b74db26968bac72ade4bd6c702be7b51ec7a.tar.xz
Bye bye Pluto!
Charon will take over IKEv1 duties from here. This also removes libfreeswan and whack.
Diffstat (limited to 'src/libfreeswan/initsubnet.c')
-rw-r--r--src/libfreeswan/initsubnet.c93
1 files changed, 0 insertions, 93 deletions
diff --git a/src/libfreeswan/initsubnet.c b/src/libfreeswan/initsubnet.c
deleted file mode 100644
index 27faddabc..000000000
--- a/src/libfreeswan/initsubnet.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * initialize subnet structure
- * Copyright (C) 2000, 2002 Henry Spencer.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/lgpl.txt>.
- *
- * This library 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 Library General Public
- * License for more details.
- */
-#include "internal.h"
-#include "freeswan.h"
-
-/*
- - initsubnet - initialize ip_subnet from address and count
- *
- * The only hard part is checking for host-part bits turned on.
- */
-err_t /* NULL for success, else string literal */
-initsubnet(addr, count, clash, dst)
-const ip_address *addr;
-int count;
-int clash; /* '0' zero host-part bits, 'x' die on them */
-ip_subnet *dst;
-{
- unsigned char *p;
- int n;
- int c;
- unsigned m;
- int die;
-
- dst->addr = *addr;
- n = addrbytesptr(&dst->addr, (const unsigned char **)&p);
- if (n == 0)
- return "unknown address family";
-
- switch (clash) {
- case '0':
- die = 0;
- break;
- case 'x':
- die = 1;
- break;
- default:
- return "unknown clash-control value in initsubnet";
- break;
- }
-
- c = count / 8;
- if (c > n)
- return "impossible mask count";
- p += c;
- n -= c;
-
- m = 0xff;
- c = count % 8;
- if (n > 0 && c != 0) /* partial byte */
- m >>= c;
- for (; n > 0; n--) {
- if ((*p & m) != 0) {
- if (die)
- return "improper subnet, host-part bits on";
- *p &= ~m;
- }
- m = 0xff;
- p++;
- }
-
- dst->maskbits = count;
- return NULL;
-}
-
-/*
- - addrtosubnet - initialize ip_subnet from a single address
- */
-err_t /* NULL for success, else string literal */
-addrtosubnet(addr, dst)
-const ip_address *addr;
-ip_subnet *dst;
-{
- int n;
-
- dst->addr = *addr;
- n = addrbytesptr(&dst->addr, (const unsigned char **)NULL);
- if (n == 0)
- return "unknown address family";
- dst->maskbits = n*8;
- return NULL;
-}