Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-image
Commits
230d201a
Commit
230d201a
authored
Feb 06, 2015
by
Nikos Skalkotos
Browse files
Add a networking driver for FreeBSD
parent
68ceeec5
Changes
3
Hide whitespace changes
Inline
Side-by-side
snf-image-helper/networking/Makefile.am
View file @
230d201a
networkingdir
=
$(libdir)
/
$(PACKAGE)
/networking
dist_networking_SCRIPTS
=
debian.sh redhat.sh
dist_networking_SCRIPTS
=
debian.sh redhat.sh
freebsd.sh
edit
=
sed
\
-e
's|@sysconfdir[@]|
$(sysconfdir)
|g'
\
...
...
snf-image-helper/networking/freebsd.sh.in
0 → 100644
View file @
230d201a
#! /bin/bash
# Copyright (C) 2015 GRNET S.A.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
set
-e
.
"@commondir@/common.sh"
CONF
=
"
$SNF_IMAGE_TARGET
/etc/rc.conf"
networking_opts
"
$@
"
if
[
"
$initialize
"
=
yes
]
;
then
cat
"
$CONF
"
>
"
$CONF
.snf_image-
$(
date
+%Y%m%d%H%M%S
)
-
$RANDOM
"
exit
0
fi
if
[
"
$finalize
"
=
yes
]
;
then
exit
0
fi
case
"
$TYPE
"
in
paravirtual
)
driver
=
vtnet
driver_index
=
$paravirtual_index
;;
rtl8139
)
driver
=
rl
driver_index
=
$rtl8139_index
;;
ne2k_isa|ne2k_pci
)
driver
=
ed
driver_index
=
$((
ne2k_isa_index
+
ne2k_pci_index
))
;;
i82551|i82557b|i82559er
)
driver
=
fxp
driver_index
=
$((
i82551_index
+
i82557b_index
+
i82559er_index
))
;;
pcnet
)
driver
=
pcn
driver_index
=
$pcnet_index
;;
e1000
)
driver
=
em
dirver_index
=
$e1000_index
;;
*
)
log_error
"Unknown card type:
\`
$TYPE
'"
esac
index
=
$((
driver_index
-
1
))
tmp_config
=
$(
mktemp
)
add_cleanup
rm
-f
"
$tmp_config
"
grep
-v
"ifconfig_
$driver$index
"
"
$CONF
"
>
"
$tmp_config
"
cat
"
$tmp_config
"
>
"
$CONF
"
if
[
"
$ipv4
"
=
'static'
]
;
then
echo
"ifconfig_
$driver$index
=
\"
inet
$IP
netmask
$(
cidr2mask
"
${
SUBNET
##*/
}
"
)
\"
"
>>
"
$CONF
"
if
[
-n
"
$GATEWAY
"
]
;
then
sed
-i
'/^defaultrouter=/d'
"
$CONF
"
echo
"defaultrouter=
\"
$GATEWAY
\"
"
>>
"
$CONF
"
fi
elif
[
"
$ipv4
"
=
'dhcp'
]
;
then
echo
"ifconfig_
$driver$index
=
\"
DHCP
\"
"
>>
"
$CONF
"
fi
if
[
"
$ipv6
"
!=
'none'
]
;
then
sed
-i
'/^ipv6_enable=/d'
"
$CONF
"
echo
'ipv6_enable="YES"'
>>
"
$CONF
"
fi
if
[
"
$ipv6
"
=
'dhcp'
]
;
then
echo
"ifconfig_
$driver
${
index
}
_ipv6=
\"
inet6 -ifdisabled accept_rtadv
\"
"
>>
$CONF
echo
-e
"dhcp6c_enable=
\"
YES
\"\n
dhcp6c_interfaces=
\"
$driver$index
\"
"
>>
$CONF
elif
[
"
$ipv6
"
=
'slaac'
-o
"
$ipv6
"
=
'slaac_dhcp'
]
;
then
echo
"ifconfig_
$driver
${
index
}
_ipv6=
\"
inet6 accept_rtadv
\"
"
>>
$CONF
sed
-i
'/^rtsold_enable=/d'
"
$CONF
"
echo
'rtsold_enable="YES"'
>>
"
$CONF
"
fi
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
snf-image-helper/tasks/50ConfigureNetwork.in
View file @
230d201a
...
...
@@ -69,6 +69,11 @@ for index in $(seq 0 $((NIC_COUNT-1))); do
eval export
SUBNET6
=
\"\$
NIC_
${
index
}
_NETWORK_SUBNET6
\"
eval export
TAGS
=
\"\$
NIC_
${
index
}
_NETWORK_TAGS
\"
# Relative to the card type index
:
$((${
TYPE
}
_index++
))
export
${
TYPE
}
_index
for
tag
in
${
TAGS
}
;
do
for
dhcp_tag
in
$SNF_IMAGE_DHCP_TAGS
;
do
if
[
"
$tag
"
=
"
$dhcp_tag
"
]
;
then
...
...
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