9front - general discussion about 9front
 help / color / mirror / Atom feed
From: akw@oneiri.one
To: 9front@9front.org
Subject: [9front] [PATCH] netaudit: recognize multiple ipnets
Date: Tue, 31 Oct 2023 14:14:31 -0700	[thread overview]
Message-ID: <DE82C70836AAD0F32A148DFE84BE3EFB@oneiri.one> (raw)

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 {


                 reply	other threads:[~2023-10-31 21:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DE82C70836AAD0F32A148DFE84BE3EFB@oneiri.one \
    --to=akw@oneiri.one \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).