瀏覽代碼

l2tpv3tun: remove due to being deprecated

Signed-off-by: Steven Barth <steven@midlink.org>
Steven Barth 10 年之前
父節點
當前提交
08ae493776

+ 0
- 50
net/l2tpv3tun/Makefile 查看文件

@@ -1,50 +0,0 @@
1
-#
2
-# Copyright (C) 2009-2010 Thomas Heil <heil@terminal-consulting.de>
3
-# Copyright (C) 2010-2011 OpenWrt.org
4
-#
5
-# This is free software, licensed under the GNU General Public License v2.
6
-# See /LICENSE for more information.
7
-
8
-include $(TOPDIR)/rules.mk
9
-
10
-PKG_NAME:=l2tpv3tun
11
-PKG_VERSION:=0.2
12
-PKG_RELEASE:=1
13
-
14
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15
-PKG_SOURCE_URL:=ftp://www.openl2tp.org/releases
16
-PKG_MD5SUM:=d3b4a9af652cca9f34d3eea4a7ff6041
17
-
18
-PKG_INSTALL:=1
19
-
20
-include $(INCLUDE_DIR)/kernel.mk
21
-include $(INCLUDE_DIR)/package.mk
22
-
23
-define Package/l2tpv3tun
24
-  SECTION:=net
25
-  CATEGORY:=Network
26
-  DEPENDS:=+libnl-tiny +ip +kmod-l2tp +kmod-l2tp-ip +kmod-l2tp-eth
27
-  TITLE:=Control utility for static L2TP v3 (Pseudowire) tunnels
28
-  MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
29
-  URL:=http://www.openl2tp.org
30
-endef
31
-
32
-define Package/l2tpv3tun/description
33
-  The l2tpv3tun utility is a command line frontend for configuring static
34
-  L2TP v3 pseudowire tunnels.
35
-endef
36
-
37
-MAKE_FLAGS += \
38
-	CC="$(TARGET_CC)" \
39
-	CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/libnl-tiny/" \
40
-	LD="$(TARGET_CC)" \
41
-	LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/ -lnl-tiny"
42
-
43
-define Package/l2tpv3tun/install
44
-	$(INSTALL_DIR) $(1)/usr/bin
45
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/l2tpv3tun $(1)/usr/bin/
46
-	$(INSTALL_DIR) $(1)/lib/network
47
-	$(INSTALL_BIN) ./files/l2tp.sh $(1)/lib/network/
48
-endef
49
-
50
-$(eval $(call BuildPackage,l2tpv3tun))

+ 0
- 213
net/l2tpv3tun/files/l2tp.sh 查看文件

@@ -1,213 +0,0 @@
1
-# l2tp.sh - L2TPv3 tunnel backend
2
-# Copyright (c) 2010 OpenWrt.org
3
-
4
-l2tp_next_tunnel_id() {
5
-	local max=0
6
-	local val
7
-	for val in $(
8
-		local l
9
-		l2tpv3tun show tunnel | while read l; do
10
-			case "$l" in
11
-				Tunnel*,*encap*) l="${l#Tunnel }"; echo "${l%%,*}";;
12
-			esac
13
-		done
14
-	); do
15
-		[ "$val" -gt "$max" ] && max="$val"
16
-	done
17
-	echo $((max + 1))
18
-}
19
-
20
-l2tp_next_session_id() {
21
-	local tunnel="$1"
22
-	local max=0
23
-	local val
24
-	for val in $(
25
-		local l
26
-		l2tpv3tun show session${tunnel:+ tunnel_id "$tunnel"} | while read l; do
27
-			case "$l" in
28
-				Session*in*) l="${l#Session }"; echo "${l%% *}";;
29
-			esac
30
-		done
31
-	); do
32
-		[ "$val" -gt "$max" ] && max="$val"
33
-	done
34
-	echo $((max + 1))
35
-}
36
-
37
-l2tp_tunnel_exists() {
38
-	test -n "$(l2tpv3tun show tunnel tunnel_id "$1" 2>/dev/null)"
39
-}
40
-
41
-l2tp_session_exists() {
42
-	test -n "$(l2tpv3tun show session tunnel_id "$1" session_id "$2" 2>/dev/null)"
43
-}
44
-
45
-l2tp_ifname() {
46
-	l2tpv3tun show session tunnel_id "$1" session_id "$2" 2>/dev/null | \
47
-		sed -ne 's/^.*interface name: //p'
48
-}
49
-
50
-l2tp_lock() {
51
-	lock /var/lock/l2tp-setup
52
-}
53
-
54
-l2tp_unlock() {
55
-	lock -u /var/lock/l2tp-setup
56
-}
57
-
58
-l2tp_log() {
59
-	logger -t "ifup-l2tp" "$@"
60
-}
61
-
62
-
63
-# Hook into scan_interfaces() to synthesize a .device option
64
-# This is needed for /sbin/ifup to properly dispatch control
65
-# to setup_interface_l2tp() even if no .ifname is set in
66
-# the configuration.
67
-scan_l2tp() {
68
-	local dev
69
-	config_get dev "$1" device
70
-	config_set "$1" device "${dev:+$dev }l2tp-$1"
71
-}
72
-
73
-coldplug_interface_l2tp() {
74
-	setup_interface_l2tp "l2tp-$1" "$1"
75
-}
76
-
77
-setup_interface_l2tp() {
78
-	local iface="$1"
79
-	local cfg="$2"
80
-	local link="l2tp-$cfg"
81
-
82
-	l2tp_lock
83
-
84
-	# prevent recursion
85
-	local up="$(uci_get_state network "$cfg" up 0)"
86
-	[ "$up" = 0 ] || {
87
-		l2tp_unlock
88
-		return 0
89
-	}
90
-
91
-	local tunnel_id
92
-	config_get tunnel_id "$cfg" tunnel_id
93
-	[ -n "$tunnel_id" ] || {
94
-		tunnel_id="$(l2tp_next_tunnel_id)"
95
-		uci_set_state network "$cfg" tunnel_id "$tunnel_id"
96
-		l2tp_log "No tunnel ID specified, assuming $tunnel_id"
97
-	}
98
-
99
-	local peer_tunnel_id
100
-	config_get peer_tunnel_id "$cfg" peer_tunnel_id
101
-	[ -n "$peer_tunnel_id" ] || {
102
-		peer_tunnel_id="$tunnel_id"
103
-		uci_set_state network "$cfg" peer_tunnel_id "$peer_tunnel_id"
104
-		l2tp_log "No peer tunnel ID specified, assuming $peer_tunnel_id"
105
-	}
106
-
107
-	local encap
108
-	config_get encap "$cfg" encap udp
109
-
110
-	local sport dport
111
-	[ "$encap" = udp ] && {
112
-		config_get sport "$cfg" sport 1701
113
-		config_get dport "$cfg" dport 1701
114
-	}
115
-
116
-	local peeraddr
117
-	config_get peeraddr "$cfg" peeraddr
118
-	[ -z "$peeraddr" ] && config_get peeraddr "$cfg" peer6addr
119
-
120
-	local localaddr
121
-	case "$peeraddr" in
122
-		*:*) config_get localaddr "$cfg" local6addr ;;
123
-		*)   config_get localaddr "$cfg" localaddr  ;;
124
-	esac
125
-
126
-	[ -n "$localaddr" -a -n "$peeraddr" ] || {
127
-		l2tp_log "Missing local or peer address for tunnel $cfg - skipping"
128
-		return 1
129
-	}
130
-
131
-	(
132
-		while ! l2tp_tunnel_exists "$tunnel_id"; do
133
-			[ -n "$sport" ] && l2tpv3tun show tunnel 2>/dev/null | grep -q "ports: $sport/" && {
134
-				l2tp_log "There already is a tunnel with src port $sport - skipping"
135
-				l2tp_unlock
136
-				return 1
137
-			}
138
-
139
-			l2tpv3tun add tunnel tunnel_id "$tunnel_id" peer_tunnel_id "$peer_tunnel_id" \
140
-				encap "$encap" local "$localaddr" remote "$peeraddr" \
141
-				${sport:+udp_sport "$sport"} ${dport:+udp_dport "$dport"}
142
-
143
-			# Wait for tunnel
144
-			sleep 1
145
-		done
146
-
147
-
148
-		local session_id
149
-		config_get session_id "$cfg" session_id
150
-		[ -n "$session_id" ] || {
151
-			session_id="$(l2tp_next_session_id "$tunnel_id")"
152
-			uci_set_state network "$cfg" session_id "$session_id"
153
-			l2tp_log "No session ID specified, assuming $session_id"
154
-		}
155
-
156
-		local peer_session_id
157
-		config_get peer_session_id "$cfg" peer_session_id
158
-		[ -n "$peer_session_id" ] || {
159
-			peer_session_id="$session_id"
160
-			uci_set_state network "$cfg" peer_session_id "$peer_session_id"
161
-			l2tp_log "No peer session ID specified, assuming $peer_session_id"
162
-		}
163
-
164
-
165
-		while ! l2tp_session_exists "$tunnel_id" "$session_id"; do
166
-			l2tpv3tun add session ifname "$link" tunnel_id "$tunnel_id" \
167
-				session_id "$session_id" peer_session_id "$peer_session_id"
168
-
169
-			# Wait for session
170
-			sleep 1
171
-		done
172
-
173
-
174
-		local dev
175
-		config_get dev "$cfg" device
176
-
177
-		local ifn
178
-		config_get ifn "$cfg" ifname
179
-
180
-		uci_set_state network "$cfg" ifname "${ifn:-$dev}"
181
-		uci_set_state network "$cfg" device "$dev"
182
-
183
-		local mtu
184
-		config_get mtu "$cfg" mtu 1462
185
-
186
-		local ttl
187
-		config_get ttl "$cfg" ttl
188
-
189
-		ip link set mtu "$mtu" ${ttl:+ ttl "$ttl"} dev "$link"
190
-
191
-		# IP setup inherited from proto static
192
-		prepare_interface "$link" "$cfg"
193
-		setup_interface_static "${ifn:-$dev}" "$cfg"
194
-
195
-		ip link set up dev "$link"
196
-
197
-		uci_set_state network "$cfg" up 1
198
-		l2tp_unlock
199
-	) &
200
-}
201
-
202
-stop_interface_l2tp() {
203
-	local cfg="$1"
204
-	local link="l2tp-$cfg"
205
-
206
-	local tunnel=$(uci_get_state network "$cfg" tunnel_id)
207
-	local session=$(uci_get_state network "$cfg" session_id)
208
-
209
-	[ -n "$tunnel" ] && [ -n "$session" ] && {
210
-		l2tpv3tun del session tunnel_id "$tunnel" session_id "$session"
211
-		l2tpv3tun del tunnel tunnel_id "$tunnel"
212
-	}
213
-}

+ 0
- 20
net/l2tpv3tun/patches/010-custom_ifname.patch 查看文件

@@ -1,20 +0,0 @@
1
---- a/main.c
2
-+++ b/main.c
3
-@@ -560,6 +560,7 @@ static void usage(void)
4
- 	fprintf(stderr, "          session_id ID peer_session_id ID\n");
5
- 	fprintf(stderr, "          [ cookie HEXSTR ] [ peer_cookie HEXSTR ]\n");
6
- 	fprintf(stderr, "          [ offset OFFSET ] [ peer_offset OFFSET ]\n");
7
-+	fprintf(stderr, "          [ ifname IFNAME ]\n");
8
- 	fprintf(stderr, "       %s del tunnel tunnel_id ID\n", L2TP_CMD_ROOT);
9
- 	fprintf(stderr, "       %s del session tunnel_id ID session_id ID\n", L2TP_CMD_ROOT);
10
- 	fprintf(stderr, "       %s show tunnel [ tunnel_id ID ]\n", L2TP_CMD_ROOT);
11
-@@ -671,6 +672,9 @@ static int parse_args(int argc, char **a
12
- 			p->peer_cookie_len = slen / 2;
13
- 			if (hex2mem(*argv, p->peer_cookie, p->peer_cookie_len) < 0)
14
- 				invarg("cookie must be a hex string\n", *argv);
15
-+		} else if (strcmp(*argv, "ifname") == 0) {
16
-+			NEXT_ARG();
17
-+			p->ifname = *argv;
18
- 		} else if (strcmp(*argv, "tunnel") == 0) {
19
- 			p->tunnel = 1;
20
- 		} else if (strcmp(*argv, "session") == 0) {

+ 0
- 23
net/l2tpv3tun/patches/100-nl_handle_alloc.patch 查看文件

@@ -1,23 +0,0 @@
1
---- a/main.c
2
-+++ b/main.c
3
-@@ -100,7 +100,7 @@ struct l2tp_data {
4
- };
5
- 
6
- /* netlink socket */
7
--static struct nl_handle *nl_sock;
8
-+static struct nl_sock *nl_sock;
9
- static int nl_family;
10
- 
11
- /*****************************************************************************
12
-@@ -788,9 +788,9 @@ static int do_show(int argc, char **argv
13
- 
14
- int do_ipl2tp(int argc, char **argv)
15
- {
16
--	nl_sock = nl_handle_alloc();
17
-+	nl_sock = nl_socket_alloc();
18
- 	if (!nl_sock) {
19
--		perror("nl_handle_alloc");
20
-+		perror("nl_socket_alloc");
21
- 		return 1;
22
- 	}
23
-