9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] netaudit: recognize multiple ipnets
@ 2023-10-31 21:14 akw
  0 siblings, 0 replies; only message in thread
From: akw @ 2023-10-31 21:14 UTC (permalink / raw)
  To: 9front

If we have multiple ips tied to a sys entry (e.g.  v4/v6), we should
be searching through each corresponding ipnet.

diff 453d3c3d4c96899c7bbca81b8a143ac7a934aebe uncommitted
--- a//rc/bin/netaudit
+++ b//rc/bin/netaudit
@@ -82,23 +82,23 @@
 }
 fn checknet {
 	echo 'checking the network tuple:'
-	ipnet=`{query sys $sysname ipnet}
-	if(~ $ipnet ''){
-		echo '	we are not in an ipnet, so looking for entries in host tuple only'
+	for(ip in `{query sys $sysname ip}){
+		for(attr in (ipnet dns ipgw auth fs)){
+			val = `{query ip $ip $attr}
+			if(! ~ $val $$attr)
+				$attr = ($$attr $val)
+		}
 	}
-	if not {
-		echo '	we are in ' 'ipnet='^$ipnet
-	}
-	ipgw=`{query sys $sysname ipgw}
-	if(~ $ipgw '' '::'){
+	if(~ $ipnet '')
+		echo '	we are not in an ipnet, so looking for entries in host tuple only'
+	if not
+		for(i in $ipnet)
+			echo '	we are in ipnet='$i
+	if(~ $ipgw '' '::')
 		echo '	we do not have an internet gateway, no ipgw= entry'
-	}
-	if not {
-		for(i in $ipgw) {
+	if not
+		for(i in $ipgw)
 			checkip ipgw $i
-		}
-	}
-	dns=`{query sys $sysname dns}
 	if(~ $dns '')
 		echo '	no dns= entry'
 	if not {
@@ -109,7 +109,6 @@
 				echo '	dns='$i 'looks ok'
 		}
 	}
-	auth=`{query sys $sysname auth}
 	if(~ $auth '')
 		echo '	no auth= entry'
 	if not {
@@ -122,7 +121,6 @@
 			}
 		}
 	}
-	fs=`{query sys $sysname fs}
 	if(~ $fs '')
 		echo '	no fs= entry (needed for tls boot)'
 	if not {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-31 21:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-31 21:14 [9front] [PATCH] netaudit: recognize multiple ipnets akw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).