/etc/init.d/networking patch

Robert Edmonds edmonds@debian.org
Mon, 9 May 2005 20:44:51 -0400


--tjCHc7DPkfUGtrlw
Content-Type: multipart/mixed; boundary="YiEDa0DAkWCtVeE4"
Content-Disposition: inline


--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi all,

I have patched /etc/init.d/networking so that it invokes the correct
sysctl command for kFreeBSD for the ip_forward and syncookies settings
in /etc/network/options.

--=20
Robert Edmonds
edmonds@debian.org

--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="init.d-networking-sysctl.diff"
Content-Transfer-Encoding: quoted-printable

--- netbase/etc/init.d/networking	2004-07-29 05:19:24.000000000 -0400
+++ /etc/init.d/networking	2005-05-09 16:35:06.000000000 -0400
@@ -35,19 +35,36 @@
 }
=20
 ip_forward () {
+    echo -n "Enabling packet forwarding..."
+    case `uname -s` in Linux)
     if [ -e /proc/sys/net/ipv4/ip_forward ]; then
-        echo -n "Enabling packet forwarding..."
         echo 1 > /proc/sys/net/ipv4/ip_forward
-        echo "done."
     fi
+    ;;
+    GNU/kFreeBSD)
+    if [ -e /bin/sysctl ]; then
+        sysctl net.inet.ip.forwarding=3D1 >/dev/null
+        sysctl net.inet6.ip6.forwarding=3D1 >/dev/null
+    fi
+    ;;
+    esac
+    echo "done."
 }
=20
 syncookies () {
+    echo -n "Enabling TCP/IP SYN cookies..."
+    case `uname -s` in Linux)
     if [ -e /proc/sys/net/ipv4/tcp_syncookies ]; then
-        echo -n "Enabling TCP/IP SYN cookies..."
         echo 1 > /proc/sys/net/ipv4/tcp_syncookies
-        echo "done."
     fi
+    ;;
+    GNU/kFreeBSD)
+    if [ -e /bin/sysctl ]; then
+        sysctl net.inet.tcp.syncookies=3D1 >/dev/null
+    fi
+    ;;
+    esac
+    echo "done."
 }
=20
 doopt () {
@@ -65,6 +82,13 @@
=20
 case "$1" in
     start)
+        case `uname -s` in GNU/kFreeBSD)
+            sysctl net.inet.ip.forwarding=3D0 >/dev/null
+            sysctl net.inet6.ip6.forwarding=3D0 >/dev/null
+            sysctl net.inet.tcp.syncookies=3D0 >/dev/null
+        ;;
+        esac
+
 	doopt spoofprotect yes
         doopt syncookies no
         doopt ip_forward no
@@ -90,11 +114,20 @@
         fi
 	;;
     force-reload|restart)
+        echo -n "Reconfiguring network interfaces..."
+        ifdown -a
+
+        case `uname -s` in GNU/kFreeBSD)
+            sysctl net.inet.ip.forwarding=3D0 >/dev/null
+            sysctl net.inet6.ip6.forwarding=3D0 >/dev/null
+            sysctl net.inet.tcp.syncookies=3D0 >/dev/null
+        ;;
+        esac
+
 	doopt spoofprotect yes
         doopt syncookies no
         doopt ip_forward no
-        echo -n "Reconfiguring network interfaces..."
-        ifdown -a
+
         ifup -a
 	echo "done."
 	;;

--YiEDa0DAkWCtVeE4--

--tjCHc7DPkfUGtrlw
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCgAQDdp+/SHMBQJERAhImAJ9mDUZykWyVfh0+sae2I0xSeAJPQgCgg9iK
tJWJgko75bXedTbFhyZZF08=
=8dcv
-----END PGP SIGNATURE-----

--tjCHc7DPkfUGtrlw--