Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bird-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
labs
bird-tools
Commits
9de005b7
Commit
9de005b7
authored
Jan 11, 2016
by
Maria Matejka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In-virtual rc.local
parent
9150ebac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
1 deletion
+165
-1
.gitignore
.gitignore
+3
-1
nfs/net/rc.local.network
nfs/net/rc.local.network
+68
-0
nfs/rc.local
nfs/rc.local
+94
-0
No files found.
.gitignore
View file @
9de005b7
img/*
iso/*
run/*
nfs/*
nfs/bird*
nfs/net/vl-*
nfs/tmp
bin/socat
nfs/net/rc.local.network
0 → 100755
View file @
9de005b7
#!/bin/bash
UNAME
=
$(
uname
)
UNAME
=
${
UNAME
,,
}
declare
-a
INTERFACES_OLD
declare
-a
INTERFACES
case
$UNAME
in
linux
)
INTERFACES_OLD+
=(
$(
(
ip
link
;
echo
"0: eof"
)
|
sed
-rn
'/^[0-9]/{s/^[0-9]+: //;s/:.*//;x;s/\n /,/;p;}; /ether/{s/.*ether (..:..:..:..:..:..).*/ \1/;H;}'
)
)
;;
*
)
INTERFACES_OLD+
=(
$(
(
ifconfig
;
echo
"eof"
)
|
sed
-rn
'/^[a-z]/{s/:.*//;x;s/\n /,/;p;}; /(ether|lladdr)/{s/.*(ether|lladdr) (..:..:..:..:..:..).*/ \2/;H;}'
)
)
;;
esac
for
I
in
${
INTERFACES_OLD
[@]
}
;
do
NAME
=
${
I
%%,*
}
MAC
=
${
I
##*,
}
MAC
=
${
MAC
,,
}
if
[
"
$NAME
"
=
"
$MAC
"
]
;
then continue
;
fi
echo
"
$NAME
->
$MAC
"
MACFILE
=
/mnt/nfs/net/vl-
${
MAC
//
:
}
if
[
!
-f
$MACFILE
]
;
then
continue
;
fi
IP4
=
$(
sed
-rn
's/^IP4 //p;'
<
$MACFILE
)
IP4PEER
=
$(
sed
-rn
's/^IP4PEER //p;'
<
$MACFILE
)
NN
=
$(
sed
-rn
's/^NAME //p;'
<
$MACFILE
)
case
$UNAME
in
linux
)
echo
"Renaming
$NAME
to
$NN
"
ip
link set
$NAME
name
$NN
NAME
=
$NN
echo
"Adding
$IP4
to
$NAME
(
$MAC
)
${
IP4PEER
:+,peer
$IP4PEER
}
"
ip
link set
$NAME
up
ip addr add
$IP4
dev
$NAME
${
IP4PEER
:+peer
$IP4PEER
}
;;
freebsd
)
echo
"Renaming
$NAME
to
$NN
"
ifconfig
$NAME
name
$NN
NAME
=
$NN
echo
"Adding
$IP4
to
$NAME
(
$MAC
)
${
IP4PEER
:+,peer
$IP4PEER
}
"
ifconfig
$NAME
up
ifconfig
$NAME
inet
$IP4
${
IP4PEER
%%/*
}
if
[
!
-z
"
$IP4PEER
"
]
;
then
route add
${
IP4PEER
%%/*
}
-iface
$NAME
;
fi
;;
openbsd
)
echo
"Can't rename
$NAME
to
$NN
"
ifconfig
$NAME
up
echo
"Adding
$IP4
to
$NAME
(
$MAC
)
${
IP4PEER
:+,peer
$IP4PEER
}
"
ifconfig
$NAME
up
ifconfig
$NAME
inet
$IP4
${
IP4PEER
%%/*
}
if
[
!
-z
"
$IP4PEER
"
]
;
then
route add
${
IP4PEER
%%/*
}
-iface
$NAME
;
fi
;;
*
)
echo
"Unknown system
$UNAME
"
;;
esac
INTERFACES+
=(
"
$NAME
,
$MAC
"
)
done
nfs/rc.local
0 → 100755
View file @
9de005b7
#!/bin/bash
H
=
$(
hostname
)
if
[
"
${
H
%%-install
}
"
!=
"
$H
"
]
;
then
echo
"Install machine. Aborting tests."
exit
0
fi
export
PATH
=
$PATH
:/usr/local/bin
.
/mnt/nfs/net/rc.local.network
OSPF_INAME_SED
=
"x;"
echo
${
INTERFACES
[@]
}
for
I
in
${
INTERFACES
[@]
}
;
do
if
[
"
${
I
:0:2
}
"
!=
"dl"
]
;
then
continue
fi
COST
=
$((
4
#${I:2:4} + 1))
OSPF_INAME_SED
=
"
$OSPF_INAME_SED
G; s/INAME/
${
I
:0:6
}
/; s/ICOST/
$COST
/;"
done
OSPF_INAME_SED
=
"
$OSPF_INAME_SED
x; s/.*//; x;"
IDBIN
=
$((
$(
hostname
|
tr
'12md'
'012#'
)
+
50
))
IDHEX
=
${
H
##md
}
CTLIP
=
10
.200.0.
$IDBIN
CTLIP6
=
fd01::
$IDHEX
case
$UNAME
in
linux
)
AUTOCONF
=
autoconf
MAKE
=
make
ip
link
add
$H
type
dummy
ip
link set
$H
up
ip addr add
$CTLIP
/32 dev
$H
ip
-6
addr add
$CTLIP6
/128 dev
$H
;;
freebsd
)
AUTOCONF
=
autoconf
MAKE
=
gmake
;;
openbsd
)
AUTOCONF
=
autoconf-2.69
MAKE
=
gmake
;;
*
)
echo
"Unknown system
$UNAME
"
;;
esac
SED_PATTERN
=
"s/CTLIP6/
$CTLIP6
/g; s/CTLIP/
$CTLIP
/g; s/IDBIN/
$IDBIN
/g; s/IDHEX/
$IDHEX
/g; /INAME/ {
$OSPF_INAME_SED
};"
CONFDIR
=
"/mnt/nfs/bird-conf"
function
runbird4
()
{
sed
"
$SED_PATTERN
"
"
$1
"
>
/
tmp/bird4.conf
rsync
-
av
/
mnt/nfs/bird/
/
tmp/bird4
cd
/
tmp/bird4
$AUTOCONF
./configure
$MAKE
./bird
-
c
/
tmp/bird4.conf
-
s ./bird.sock
-
P ./bird.pid
}
function
runbird6
()
{
sed
"
$SED_PATTERN
"
"
$1
"
>
/
tmp/bird6.conf
rsync
-
av
/
mnt/nfs/bird/
/
tmp/bird6
cd
/
tmp/bird6
$AUTOCONF
./configure
--
enable-ipv6
$MAKE
./bird
-
c
/
tmp/bird6.conf
-
s ./bird.sock
-
P ./bird.pid
}
function
runbird
()
{
sed
"
$SED_PATTERN
"
"
$1
"
>
/
tmp/bird-int.conf
rsync
-
av
/
mnt/nfs/bird/
/
tmp/bird
cd
/
tmp/bird
$AUTOCONF
./configure
sed
-
i
's/-g -O2/-g3 -O0/'
obj/Rules
$MAKE
./bird
-
c
/
tmp/bird-int.conf
-
s ./bird.sock
-
P ./bird.pid
}
#runbird $CONFDIR/bird-int-4.conf
runbird4
$CONFDIR
/
bird-int-4-old.conf
#runbird $CONFDIR/bird-int-6.conf
runbird6
$CONFDIR
/
bird-int-6-old.conf
#runbird $CONFDIR/bird-int-template.conf
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