Fixes #183.
install:
-mkdir -pv $(DESTDIR)/etc/{network,ppp}
- -mkdir -pv $(DESTDIR)/lib/network
+ -mkdir -pv $(DESTDIR)/lib/{network,udev}
-mkdir -pv $(DESTDIR)/sbin
-mkdir -pv $(DESTDIR)/usr/lib/sysctl.d
-mkdir -pv $(DESTDIR)/var/log/network
cp -rfv {hooks,header*,functions*} $(DESTDIR)/lib/network/
cp -fv sysctl.d/* $(DESTDIR)/usr/lib/sysctl.d/
+ cp -rfv udev/* $(DESTDIR)/lib/udev
install -m 755 -v ppp/ip-updown $(DESTDIR)/etc/ppp
ln -svf ip-updown $(DESTDIR)/etc/ppp/ip-pre-up
TIMEOUT_RESTART=2
DEVICE_PRINT_LINE1=" %-24s %s\n"
+
+PORT_PATTERN=portN
#assert device_exists ${device}
if ! device_is_free ${device}; then
- log ERROR "The device '${device}' does not look to be unused."
- log ERROR "Don't proceed."
- # return ${EXIT_ERROR}
+ log ERROR "The device '${device}' is in use."
+ return ${EXIT_ERROR}
fi
for port in $(ports_get_all); do
port_cmd hotplug ${port} ${device}
if [ $? -eq ${EXIT_OK} ]; then
echo "${port}"
- exit ${EXIT_OK}
+ return ${EXIT_OK}
fi
done
- exit ${EXIT_ERROR}
+ port_find_free ${PORT_PATTERN}
+ return $?
}
port=${pattern//N/${i}}
if ! port_exists ${port} && ! device_exists ${port}; then
echo "${port}"
- break
+ return ${EXIT_OK}
fi
i=$(( ${i} + 1 ))
done
+
+ return ${EXIT_ERROR}
}
function port_get_info() {
--- /dev/null
+#!/bin/bash
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2011 Michael Tremer & Christian Schmidt #
+# #
+# 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 3 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, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+. /lib/network/functions
+
+# Check if the INTERFACE variable is properly set.
+assert isset INTERFACE
+
+# Get the name of that device from the configuration
+# or return a new one if it is unknown.
+device_hotplug ${INTERFACE}
+
+exit $?
--- /dev/null
+
+# Call a script that checks for the right name of the new device.
+# It is either renamed to match an existing configuration or gets
+# a new name.
+ACTION=="add", SUBSYSTEM=="net", PROGRAM="/lib/udev/network-hotplug-rename", RESULT=="?*", ENV{INTERFACE_NAME}="$result"
+
+# Handle all plugged-in devices.
+#SUBSYSTEM=="net", RUN+="/lib/udev/network-hotlug"