Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nextgen-router
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
nextgen-router
Commits
f5c47f8e
Commit
f5c47f8e
authored
Dec 11, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add selection mark
parent
86648fd5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
14 deletions
+22
-14
files/bridge-post-scripts/post-up.sh.j2
files/bridge-post-scripts/post-up.sh.j2
+4
-2
files/bridge-post-scripts/pre-down.sh.j2
files/bridge-post-scripts/pre-down.sh.j2
+4
-2
files/ppp-post-scripts/postdown.sh.j2
files/ppp-post-scripts/postdown.sh.j2
+5
-3
files/ppp-post-scripts/postup.sh.j2
files/ppp-post-scripts/postup.sh.j2
+9
-7
No files found.
files/bridge-post-scripts/post-up.sh.j2
View file @
f5c47f8e
...
...
@@ -25,7 +25,8 @@ handle_gateway() {
GATEWAY_ADDRESS
=
$2
GATEWAY_MAC
=
$3
GATEWAY_NO_ORIGIN
=
$4
GATEWAY_NEXT_HOP_MARK
=
$[$GATEWAY_ID
+ 1100]
GATEWAY_NEXT_HOP_MARK
=
$((
GATEWAY_ID
+
1100
))
GATEWAY_SELECTION_MARK
=
$((
GATEWAY_NEXT_HOP_MARK
+
50
))
BRIDGE_IP
=
$(
ip
-4
addr show dev
"
$BRIDGE_NAME
"
|
grep
'inet '
|
awk
'{print $2}'
)
if
[[
"
$GATEWAY_ADDRESS
"
-eq
"_use_first"
]]
;
then
GATEWAY_ADDRESS
=
$(
subnetcalc
"
$BRIDGE_IP
"
-n
|
grep
"Host Range"
|
awk
'{print $5}'
)
...
...
@@ -39,8 +40,9 @@ handle_gateway() {
ip route add default via
"
$GATEWAY_ADDRESS
"
metric
"
$GATEWAY_NEXT_HOP_MARK
"
{
% endif %
}
ip rule add pref 100 fwmark
"
$GATEWAY_NEXT_HOP_MARK
"
lookup
"
$GATEWAY_NEXT_HOP_MARK
"
ip rule add pref 400 fwmark
"
$GATEWAY_SELECTION_MARK
"
lookup
"
$GATEWAY_NEXT_HOP_MARK
"
if
[[
"
$GATEWAY_NO_ORIGIN
"
-eq
0
]]
;
then
ip rule add pref 100 fwmark
"
$GATEWAY_NEXT_HOP_MARK
"
lookup
"
$GATEWAY_NEXT_HOP_MARK
"
eth_origin
-A
"
$BRIDGE_NAME
"
"
$GATEWAY_ID
"
"
$GATEWAY_ADDRESS
"
"
$GATEWAY_MAC
"
fi
}
...
...
files/bridge-post-scripts/pre-down.sh.j2
View file @
f5c47f8e
...
...
@@ -17,7 +17,8 @@ handle_gateway() {
GATEWAY_ADDRESS
=
$2
GATEWAY_MAC
=
$3
GATEWAY_NO_ORIGIN
=
$4
GATEWAY_NEXT_HOP_MARK
=
$[$GATEWAY_ID
+ 1100]
GATEWAY_NEXT_HOP_MARK
=
$((
GATEWAY_ID
+
1100
))
GATEWAY_SELECTION_MARK
=
$((
GATEWAY_NEXT_HOP_MARK
+
50
))
BRIDGE_IP
=
$(
ip
-4
addr show dev
"
$BRIDGE_NAME
"
|
grep
'inet '
|
awk
'{print $2}'
)
if
[[
"
$GATEWAY_ADDRESS
"
-eq
"_use_first"
]]
;
then
GATEWAY_ADDRESS
=
$(
subnetcalc
"
$BRIDGE_IP
"
-n
|
grep
"Host Range"
|
awk
'{print $5}'
)
...
...
@@ -26,8 +27,9 @@ handle_gateway() {
GATEWAY_ADDRESS
=
$(
subnetcalc
"
$BRIDGE_IP
"
-n
|
grep
"Host Range"
|
awk
'{print $7}'
)
fi
ip rule del pref 100 fwmark
"
$GATEWAY_NEXT_HOP_MARK
"
lookup
"
$GATEWAY_NEXT_HOP_MARK
"
ip rule add pref 400 fwmark
"
$GATEWAY_SELECTION_MARK
"
lookup
"
$GATEWAY_NEXT_HOP_MARK
"
if
[[
"
$GATEWAY_NO_ORIGIN
"
-eq
0
]]
;
then
ip rule del pref 100 fwmark
"
$GATEWAY_NEXT_HOP_MARK
"
lookup
"
$GATEWAY_NEXT_HOP_MARK
"
eth_origin
-D
"
$BRIDGE_NAME
"
"
$GATEWAY_ID
"
"
$GATEWAY_ADDRESS
"
"
$GATEWAY_MAC
"
fi
}
...
...
files/ppp-post-scripts/postdown.sh.j2
View file @
f5c47f8e
#!/bin/bash
source
{{
ansible_user_dir
}}
/nextgen-router/scripts/utility.sh
INIT_ID
=
$[
1000 +
$(
echo
"
$PPP_IFACE
"
|
sed
"s/ppp//g"
)
]
PPPOE_NEXT_HOP_MARK
=
$[
1000 +
$(
echo
"
$PPP_IFACE
"
|
sed
"s/ppp//g"
)
]
PPPOE_SELECTION_MARK
=
$((
PPPOE_NEXT_HOP_MARK
+
50
))
iptables-save |
grep
--
'-j TCPMSS'
|
grep
--
"
$PPP_IFACE
"
|
sed
's/^-A/-D/g'
| xargs
-I
'{}'
bash
-c
'iptables -t mangle {}'
ip6tables-save |
grep
--
'-j TCPMSS'
|
grep
--
"
$PPP_IFACE
"
|
sed
's/^-A/-D/g'
| xargs
-I
'{}'
bash
-c
'ip6tables -t mangle {}'
iptables
-t
nat
-o
"
$PPP_IFACE
"
-D
POSTROUTING
-j
MASQUERADE
ip rule del pref 100 fwmark
$INIT_ID
lookup
$INIT_ID
ip
-6
rule del pref 100 fwmark
$INIT_ID
lookup
$INIT_ID
ip rule del pref 100 fwmark
$PPPOE_NEXT_HOP_MARK
lookup
$PPPOE_NEXT_HOP_MARK
ip rule del pref 400 fwmark
$PPPOE_SELECTION_MARK
lookup
$PPPOE_NEXT_HOP_MARK
ip
-6
rule del pref 100 fwmark
$PPPOE_NEXT_HOP_MARK
lookup
$PPPOE_NEXT_HOP_MARK
ppp_origin
-D
"
$PPP_IFACE
"
...
...
files/ppp-post-scripts/postup.sh.j2
View file @
f5c47f8e
#!/bin/bash
source
{{
ansible_user_dir
}}
/nextgen-router/scripts/utility.sh
INIT_ID
=
$[
1000 +
$(
echo
"
$PPP_IFACE
"
|
sed
"s/ppp//g"
)
]
PPPOE_NEXT_HOP_MARK
=
$[
1000 +
$(
echo
"
$PPP_IFACE
"
|
sed
"s/ppp//g"
)
]
PPPOE_SELECTION_MARK
=
$((
PPPOE_NEXT_HOP_MARK
+
50
))
INTERFACE_MTU
=
$(
ip
link
show dev
"
$PPP_IFACE
"
|
grep
-oP
'mtu \d+'
|
cut
-c
5-
)
...
...
@@ -15,15 +16,16 @@ ip6tables -t mangle -A FORWARD -i "$PPP_IFACE" -p tcp -m tcp --tcp-flags SYN,RST
iptables
-t
nat
-o
"
$PPP_IFACE
"
-A
POSTROUTING
-j
MASQUERADE
ip route add default dev
"
$PPP_IFACE
"
table
$INIT_ID
ip route add default dev
"
$PPP_IFACE
"
metric
$INIT_ID
ip rule add pref 100 fwmark
$INIT_ID
lookup
$INIT_ID
ip route add default dev
"
$PPP_IFACE
"
table
$PPPOE_NEXT_HOP_MARK
ip route add default dev
"
$PPP_IFACE
"
metric
$PPPOE_NEXT_HOP_MARK
ip rule add pref 100 fwmark
$PPPOE_NEXT_HOP_MARK
lookup
$PPPOE_NEXT_HOP_MARK
ip rule add pref 400 fwmark
$PPPOE_SELECTION_MARK
lookup
$PPPOE_NEXT_HOP_MARK
ip
-6
addr show dev
"
$PPP_IFACE
"
|
grep
"inet6"
if
[[
"
$?
"
==
0
]]
;
then
ip
-6
route add default dev
"
$PPP_IFACE
"
table
$
INIT_ID
ip
-6
route add default dev
"
$PPP_IFACE
"
metric
$
INIT_ID
ip
-6
rule add pref 100 fwmark
$
INIT_ID
lookup
$INIT_ID
ip
-6
route add default dev
"
$PPP_IFACE
"
table
$
PPPOE_NEXT_HOP_MARK
ip
-6
route add default dev
"
$PPP_IFACE
"
metric
$
PPPOE_NEXT_HOP_MARK
ip
-6
rule add pref 100 fwmark
$
PPPOE_NEXT_HOP_MARK
lookup
$PPPOE_NEXT_HOP_MARK
cd
{{
ansible_user_dir
}}
/nextgen-router/services/dhcpv6
{
%
for
br
in
bridges %
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment