NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Is it possible to completely disable ipv6 in NetBSD 10



    Date:        Thu, 13 Nov 2025 14:09:26 -0800
    From:        "Greg A. Woods" <woods%planix.ca@localhost>
    Message-ID:  <m1vJfVO-00Mo5fC@more.local>


  | +			/usr/sbin/ndp -i $int disabled >/dev/null
  | +			for lladdr in $(/sbin/ifconfig $int | awk '$1 == "inet6" {print $2}'); do
  | +				/sbin/ifconfig $int inet6 delete $lladdr
  | +			done


We won't be putting uses of awk in rc.d/netstart - after all, /usr (where
awk lives) might be a shared remote filesystem mounted over the network.

But in any case, for what it is being used for here, it is *way* overkill.
(sed would be better if an external tool were needed, but it has the same
issue wrt being able to be found.)

	IFS=$'\n'
	for lladdr in $(/sbin/ifconfig "$int" |
			   while read word arg stuff
			   do
				case $word in
				(inet6)  printf '%s\n' "${arg}";;
				esac
			   done )
	do
		/sbin/ifconfig "$int" inet6 delete "$lladdr"
	done
	unset IFS

should work, shouldn't it ?   (Uses nothing but ifconfig & sh builtins).

We should also have a similar mechanism to delete IPv4 of course.

Please test (I won't, I don't want IPv6 disabled, I use that far more than v4).

kre



Home | Main Index | Thread Index | Old Index