]>
Commit | Line | Data |
---|---|---|
ffeb717f | 1 | #!/bin/sh |
66c36198 PM |
2 | ############################################################################### |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
ffeb717f AF |
21 | |
22 | . /etc/sysconfig/rc | |
23 | . ${rc_functions} | |
24 | ||
25 | if [ -e /etc/init.d/swconfig.user ]; then | |
26 | /etc/init.d/swconfig.user $* | |
27 | exit ${?} | |
28 | fi | |
29 | ||
30 | if [ -e /var/ipfire/ethernet/swconfig_mac ]; then | |
31 | SWMAC=`cat /var/ipfire/ethernet/swconfig_mac` | |
32 | else | |
33 | # Generate a random local administrated mac address for vlan swconfig. | |
34 | SWMAC=`printf "%1x2:%02x:%02x:%02x:%02x" $[RANDOM%16] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]` | |
35 | echo $SWMAC > /var/ipfire/ethernet/swconfig_mac | |
36 | fi | |
37 | ||
38 | case "${1}" in | |
39 | start) | |
309b7de8 | 40 | case `cat /proc/device-tree/model 2>/dev/null` in |
4a277656 | 41 | "Lamobo R1") |
ffeb717f AF |
42 | # |
43 | # Lamobo R1 aka BPi R1 Routerboard | |
44 | # | |
4a277656 | 45 | # Speaker | LAN4 | LAN3 | LAN2 | LAN1 || WAN | HDMI |
ffeb717f | 46 | # SW-Port | P2 | P1 | P0 | P4 || P3 | |
0115483c | 47 | # MAC-Add | 14 | 13 | 12 | 11 || 10 | |
ffeb717f | 48 | # |
0115483c AF |
49 | # Switch-Port P8 - internal CPU Port |
50 | ||
51 | # stop udev... | |
52 | killall udevd | |
4a277656 AF |
53 | |
54 | device=`ls /sys/class/net/*/device/driver/1c50000.ethernet/net | head -1` | |
ffeb717f | 55 | ip link set $device up |
4a277656 | 56 | |
ffeb717f | 57 | # set local mac addresses. |
0115483c AF |
58 | ip link set dev wan address $SWMAC:10 |
59 | ip link set dev lan1 address $SWMAC:11 | |
60 | ip link set dev lan2 address $SWMAC:12 | |
61 | ip link set dev lan3 address $SWMAC:13 | |
62 | ip link set dev lan4 address $SWMAC:14 | |
63 | ||
64 | # start udev... | |
ffeb717f AF |
65 | killall udevd |
66 | /etc/init.d/udev start | |
67 | ;; | |
0115483c | 68 | esac 2> /dev/null |
ffeb717f AF |
69 | exit 0 |
70 | ;; | |
71 | ||
72 | *) | |
73 | echo "Usage: ${0} {start}" | |
74 | exit 1 | |
75 | ;; | |
76 | esac |