From ec77f0bef381d18a7cb6847d3e0f02c0f4087f05 Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 5 Jan 2016 21:20:47 +0000 Subject: Use the more proper -f. Leave /bin/rm in place since that's what other rc scripts have, though it isn't strictly necessary. --- etc/rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/rc b/etc/rc index 2c90f38..2127d78 100644 --- a/etc/rc +++ b/etc/rc @@ -132,9 +132,9 @@ done # Remove the firstboot sentinel, and reboot if it was requested. if [ -e ${firstboot_sentinel} ]; then [ ${root_rw_mount} = "yes" ] || mount -uw / - /bin/rm ${firstboot_sentinel} + /bin/rm -f ${firstboot_sentinel} if [ -e ${firstboot_sentinel}-reboot ]; then - /bin/rm ${firstboot_sentinel}-reboot + /bin/rm -f ${firstboot_sentinel}-reboot [ ${root_rw_mount} = "yes" ] || mount -ur / kill -INT 1 fi -- cgit v1.1 From a6cc4bb03ba02bda535f6c553c36fbe393defb2e Mon Sep 17 00:00:00 2001 From: asomers Date: Wed, 6 Jan 2016 00:00:11 +0000 Subject: "source routing" in rpcbind Fix a bug in rpcbind for multihomed hosts. If the server had interfaces on two separate subnets, and a client on the first subnet contacted rpcbind at the address on the second subnet, rpcbind would advertise addresses on the first subnet. This is a bug, because it should prefer to advertise the address where it was contacted. The requested service might be firewalled off from the address on the first subnet, for example. usr.sbin/rpcbind/check_bound.c If the address on which a request was received is known, pass that to addrmerge as the clnt_uaddr parameter. That is what addrmerge's comment indicates the parameter is supposed to mean. The previous behavior is that clnt_uaddr would contain the address from which the client sent the request. usr.sbin/rpcbind/util.c Modify addrmerge to prefer to use an IP that is equal to clnt_uaddr, if one is found. Refactor the relevant portion of the function for clarity, and to reduce the number of ifdefs. etc/mtree/BSD.tests.dist usr.sbin/rpcbind/tests/Makefile usr.sbin/rpcbind/tests/addrmerge_test.c Add unit tests for usr.sbin/rpcbind/util.c:addrmerge. usr.sbin/rpcbind/check_bound.c usr.sbin/rpcbind/rpcbind.h usr.sbin/rpcbind/util.c Constify some function arguments Reviewed by: imp MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D4690 --- etc/mtree/BSD.tests.dist | 2 ++ 1 file changed, 2 insertions(+) (limited to 'etc') diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index ad76402..ff32324 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -622,6 +622,8 @@ .. pw .. + rpcbind + .. sa .. .. -- cgit v1.1 From 76cb3b35021b722f3e8330ec6ac0df444fdcc651 Mon Sep 17 00:00:00 2001 From: imp Date: Wed, 6 Jan 2016 17:13:40 +0000 Subject: Try a little harder to remove firstboot and firstboot-reboot files in case they accidentally get created as directories or with flags that prevent their removal. While I wouldn't normally go the extra mile here and let the normal unix rules prevail, the effects of failure are large enough that extra care is warranted. --- etc/rc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/rc b/etc/rc index 2127d78..576ddf9 100644 --- a/etc/rc +++ b/etc/rc @@ -130,11 +130,17 @@ for _rc_elem in ${files}; do done # Remove the firstboot sentinel, and reboot if it was requested. +# Be a bit paranoid about removing it to handle the common failure +# modes since the consequence of failure can be big. +# Note: this assumes firstboot_sentinel is on / when we have +# a read-only /, or that it is on media that's writable. if [ -e ${firstboot_sentinel} ]; then [ ${root_rw_mount} = "yes" ] || mount -uw / - /bin/rm -f ${firstboot_sentinel} + chflags -R 0 ${firstboot_sentinel} + rm -rf ${firstboot_sentinel} if [ -e ${firstboot_sentinel}-reboot ]; then - /bin/rm -f ${firstboot_sentinel}-reboot + chflags -R 0 ${firstboot_sentinel}-reboot + rm -rf ${firstboot_sentinel}-reboot [ ${root_rw_mount} = "yes" ] || mount -ur / kill -INT 1 fi -- cgit v1.1