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
08f3e650
Commit
08f3e650
authored
Jul 21, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
online check
parent
85cb96f2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
files/bridge-post-scripts/pre-up.sh.j2
files/bridge-post-scripts/pre-up.sh.j2
+11
-7
files/ppp-macvlan-scripts/pre-up.sh.j2
files/ppp-macvlan-scripts/pre-up.sh.j2
+4
-0
files/utility.sh.j2
files/utility.sh.j2
+15
-0
No files found.
files/bridge-post-scripts/pre-up.sh.j2
View file @
08f3e650
...
@@ -3,19 +3,23 @@
...
@@ -3,19 +3,23 @@
source
{{
ansible_user_dir
}}
/nextgen-router/scripts/utility.sh
source
{{
ansible_user_dir
}}
/nextgen-router/scripts/utility.sh
export
BRIDGE_NAME
={{
br.name
}}
export
BRIDGE_NAME
={{
br.name
}}
{
%
if
br.macvlan is defined and br.macvlan %
}
{
%
if
br.linkUp is defined and br.linkUp %
}
# macvlans
{{
br.linkUp
}}
{
% endif %
}
{
%
for
link
in
br.links %
}
{
%
for
link
in
br.links %
}
# macvlan {{br.name}}-{{link | regex_replace('\.', '-')}} of {{link}}
# link {{link}}
## Ensure link is up
_wait_for_interface_online
"{{link}}"
{
%
if
br.macvlan is defined and br.macvlan %
}
## macvlan {{br.name}}-{{link | regex_replace('\.', '-')}} of {{link}}
ip
link
add
link
{{
link
}}
dev
{{
br.name
}}
-
{{
link
| regex_replace
(
'\.'
,
'-'
)}}
type
macvlan
ip
link
add
link
{{
link
}}
dev
{{
br.name
}}
-
{{
link
| regex_replace
(
'\.'
,
'-'
)}}
type
macvlan
ip
link set
{{
br.name
}}
-
{{
link
| regex_replace
(
'\.'
,
'-'
)}}
up
ip
link set
{{
br.name
}}
-
{{
link
| regex_replace
(
'\.'
,
'-'
)}}
up
{
% endfor %
}
{
% endif %
}
{
% endif %
}
{
% endfor %
}
{
%
if
br.linkUp is defined and br.linkUp %
}
{{
br.linkUp
}}
{
% endif %
}
{
%
if
br.mac is defined and br.mac %
}
{
%
if
br.mac is defined and br.mac %
}
# Change mac
# Change mac
...
...
files/ppp-macvlan-scripts/pre-up.sh.j2
View file @
08f3e650
#!/bin/bash
#!/bin/bash
source
{{
ansible_user_dir
}}
/nextgen-router/scripts/utility.sh
_wait_for_interface_online
{{
ppp.link
}}
ip
link
add
link
{{
ppp.link
}}
dev pppm
{{
ppp.id
}}
type
macvlan
ip
link
add
link
{{
ppp.link
}}
dev pppm
{{
ppp.id
}}
type
macvlan
ip
link set
pppm
{{
ppp.id
}}
up
ip
link set
pppm
{{
ppp.id
}}
up
{
%
if
ppp.mac is defined and ppp.mac %
}
{
%
if
ppp.mac is defined and ppp.mac %
}
...
...
files/utility.sh.j2
View file @
08f3e650
...
@@ -43,3 +43,18 @@ eth_origin() {
...
@@ -43,3 +43,18 @@ eth_origin() {
iptables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$BRIDGE_NAME" -m mac --mac-source "$GATEWAY_MAC" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK"
iptables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$BRIDGE_NAME" -m mac --mac-source "$GATEWAY_MAC" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK"
# ip6tables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$BRIDGE_NAME" -m mac --mac-source "$GATEWAY_MAC" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK"
# ip6tables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$BRIDGE_NAME" -m mac --mac-source "$GATEWAY_MAC" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK"
}
}
_wait_for_interface_online() {
INTERFACE=$1
echo "Waiting for interface $INTERFACE."
CURRENT_STATUS=1
while [[ "$CURRENT_STATUS" != 0 ]]; do
ifconfig "$INTERFACE" | grep 'RUNNING'
CURRENT_STATUS=$?
if [[ "$CURRENT_STATUS" != 0 ]]; then
echo "Interface $INTERFACE is bad. Will try again after 3s."
sleep 3
fi
done
echo "Interface $INTERFACE is OK."
}
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