aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2023-03-08 06:53:22 -0500
committerLibravatar netblue30 <netblue30@protonmail.com>2023-03-08 06:53:22 -0500
commit4b760f4f3d3bb82ec054bc4479cc5829298ea3e5 (patch)
tree59108855fdaa9eafa9e1b3db3f807f6b37e3f0ab
parenttesting (diff)
downloadfirejail-4b760f4f3d3bb82ec054bc4479cc5829298ea3e5.tar.gz
firejail-4b760f4f3d3bb82ec054bc4479cc5829298ea3e5.tar.zst
firejail-4b760f4f3d3bb82ec054bc4479cc5829298ea3e5.zip
add ipv6 support in --net.print
-rw-r--r--src/fnet/interface.c17
-rwxr-xr-xtest/network/netstats.exp13
-rwxr-xr-xtest/network/network.sh5
3 files changed, 25 insertions, 10 deletions
diff --git a/src/fnet/interface.c b/src/fnet/interface.c
index ca7c744ed..50e1beaa0 100644
--- a/src/fnet/interface.c
+++ b/src/fnet/interface.c
@@ -213,6 +213,23 @@ void net_ifprint(int scan) {
213 fmessage("%-17.17s%-19.19s%-17.17s%-17.17s%-6.6s\n", 213 fmessage("%-17.17s%-19.19s%-17.17s%-17.17s%-6.6s\n",
214 ifa->ifa_name, macstr, ipstr, maskstr, status); 214 ifa->ifa_name, macstr, ipstr, maskstr, status);
215 215
216 // print ipv6 address
217 if (!scan) {
218 struct ifaddrs *ptr = ifa->ifa_next;
219 while (ptr) {
220 if (ptr->ifa_addr->sa_family == AF_INET6 && strcmp(ifa->ifa_name, ptr->ifa_name) == 0) {
221 struct sockaddr_in6 *s6 = (struct sockaddr_in6 *)ptr->ifa_addr;
222 struct in6_addr *in_addr = &s6->sin6_addr;
223 char buf[64];
224 if(inet_ntop(ptr->ifa_addr->sa_family, in_addr, buf, sizeof(buf))) {
225 fmessage("%-35.35s %s\n", " ", buf);
226 break;
227 }
228 }
229 ptr = ptr->ifa_next;
230 }
231 }
232
216 // network scanning 233 // network scanning
217 if (!scan) // scanning disabled 234 if (!scan) // scanning disabled
218 continue; 235 continue;
diff --git a/test/network/netstats.exp b/test/network/netstats.exp
index a8b28bed8..0d1bc4c2c 100755
--- a/test/network/netstats.exp
+++ b/test/network/netstats.exp
@@ -20,12 +20,11 @@ expect {
20 timeout {puts "TESTING ERROR 2\n";exit} 20 timeout {puts "TESTING ERROR 2\n";exit}
21 "statistics only for sandboxes using a new network namespace" 21 "statistics only for sandboxes using a new network namespace"
22} 22}
23# not supported on github workflows - not a tty! 23sleep 4
24#expect { 24
25# timeout {puts "TESTING ERROR 3\n";exit} 25expect {
26# "firejail --name=test --net=br0" 26 timeout {puts "TESTING ERROR 3\n";exit}
27#} 27 "firejail --name=test --net=br0"
28#after 500 28}
29#send -- "\r"
30after 500 29after 500
31puts "\nall done\n" 30puts "\nall done\n"
diff --git a/test/network/network.sh b/test/network/network.sh
index 5e320cc2f..dad1ed42d 100755
--- a/test/network/network.sh
+++ b/test/network/network.sh
@@ -42,9 +42,8 @@ echo "TESTING: ipv6 (ip6.exp)"
42echo "TESTING: ipv6 netfilter (ip6_netfilter.exp)" 42echo "TESTING: ipv6 netfilter (ip6_netfilter.exp)"
43./ip6_netfilter.exp 43./ip6_netfilter.exp
44 44
45# not supported on github workflows - not a tty! 45echo "TESTING: netstats (netstats.exp)"
46#echo "TESTING: netstats (netstats.exp)" 46./netstats.exp
47#./netstats.exp
48 47
49echo "TESTING: firemon arp (firemon-arp.exp)" 48echo "TESTING: firemon arp (firemon-arp.exp)"
50./firemon-arp.exp 49./firemon-arp.exp