Skip to content

Instantly share code, notes, and snippets.

@highgain86j
Created September 13, 2019 08:00
Show Gist options
  • Save highgain86j/c3c288d8a276a9b6882079b6c456b178 to your computer and use it in GitHub Desktop.
Save highgain86j/c3c288d8a276a9b6882079b6c456b178 to your computer and use it in GitHub Desktop.
Obvious, isn't it?
*** dslite.sh.orig 2019-09-13 16:50:15.182508583 +0900
--- dslite.sh 2019-09-13 16:51:34.557074668 +0900
***************
*** 1,3 ****
--- 1,4 ----
+
#!/bin/sh
# dslite.sh - IPv4-in-IPv6 tunnel backend
# Copyright (c) 2013 OpenWrt.org
*************** proto_dslite_setup() {
*** 15,22 ****
local link="ds-$cfg"
local remoteip6
! local mtu ttl peeraddr ip6addr tunlink zone weakif encaplimit
! json_get_vars mtu ttl peeraddr ip6addr tunlink zone weakif encaplimit
[ -z "$peeraddr" ] && {
proto_notify_error "$cfg" "MISSING_ADDRESS"
--- 16,23 ----
local link="ds-$cfg"
local remoteip6
! local mtu ttl peeraddr ip6addr tunlink zone weakif encaplimit ipaddr netmask
! json_get_vars mtu ttl peeraddr ip6addr tunlink zone weakif encaplimit ipaddr netmask
[ -z "$peeraddr" ] && {
proto_notify_error "$cfg" "MISSING_ADDRESS"
*************** proto_dslite_setup() {
*** 59,87 ****
proto_init_update "$link" 1
proto_add_ipv4_route "0.0.0.0" 0
! proto_add_ipv4_address "192.0.0.2" "" "" "192.0.0.1"
proto_add_tunnel
json_add_string mode ipip6
! json_add_int mtu "${mtu:-1280}"
json_add_int ttl "${ttl:-64}"
json_add_string local "$ip6addr"
json_add_string remote "$peeraddr"
[ -n "$tunlink" ] && json_add_string link "$tunlink"
json_add_object "data"
! [ -n "$encaplimit" ] && json_add_string encaplimit "$encaplimit"
json_close_object
proto_close_tunnel
proto_add_data
! [ -n "$zone" ] && json_add_string zone "$zone"
! json_add_array firewall
! json_add_object ""
! json_add_string type nat
! json_add_string target ACCEPT
! json_close_object
! json_close_array
proto_close_data
proto_send_update "$cfg"
--- 60,88 ----
proto_init_update "$link" 1
proto_add_ipv4_route "0.0.0.0" 0
! [ -n "$ipaddr" ] && proto_add_ipv4_address "$ipaddr" "${netmask:-255.255.255.255}" "" ""
proto_add_tunnel
json_add_string mode ipip6
! json_add_int mtu "${mtu:-1460}"
json_add_int ttl "${ttl:-64}"
json_add_string local "$ip6addr"
json_add_string remote "$peeraddr"
[ -n "$tunlink" ] && json_add_string link "$tunlink"
json_add_object "data"
! json_add_string encaplimit "${encaplimit:-ignore}"
json_close_object
proto_close_tunnel
proto_add_data
! json_add_string zone "${zone:-wan}"
! #json_add_array firewall
! # json_add_object ""
! # json_add_string type nat
! # json_add_string target ACCEPT
! # json_close_object
! #json_close_array
proto_close_data
proto_send_update "$cfg"
*************** proto_dslite_init_config() {
*** 103,110 ****
--- 104,114 ----
proto_config_add_string "encaplimit"
proto_config_add_string "zone"
proto_config_add_string "weakif"
+ proto_config_add_string "ipaddr"
+ proto_config_add_string "netmask"
}
[ -n "$INCLUDE_ONLY" ] || {
add_protocol dslite
}
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment