summaryrefslogtreecommitdiff
path: root/sys/src/cmd/ratfs/main.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2019-02-11 23:38:58 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2019-02-11 23:38:58 +0100
commit50e617f8b60b61e98538cb8ccb09958740defb9a (patch)
tree4b7c197d3a998a02fbf62370d5ce6e5ab1ccd5b1 /sys/src/cmd/ratfs/main.c
parent168dabc142d40a1cdce87e836806a9913bb6534e (diff)
ratfs: implement ipv6 support, replace v4parsecidr() with parseipandmask()
Diffstat (limited to 'sys/src/cmd/ratfs/main.c')
-rw-r--r--sys/src/cmd/ratfs/main.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/sys/src/cmd/ratfs/main.c b/sys/src/cmd/ratfs/main.c
index 7c83c892d..c0add934f 100644
--- a/sys/src/cmd/ratfs/main.c
+++ b/sys/src/cmd/ratfs/main.c
@@ -39,9 +39,6 @@ int trustedqid = Qtrustedfile;
char *ctlfile = CTLFILE;
char *conffile = CONFFILE;
-#pragma varargck type "I" Cidraddr*
-
-static int ipconv(Fmt*);
static void post(int, char*);
static void setroot(void);
@@ -75,7 +72,9 @@ main(int argc, char *argv[])
if(argc != 0)
usage();
- fmtinstall('I', ipconv);
+ fmtinstall('I', eipfmt);
+ fmtinstall('M', eipfmt);
+
setroot();
getconf();
reload();
@@ -263,10 +262,10 @@ printnode(Node *np)
fprint(debugfd, "\tTrusted Child: %p", np->children);
break;
case Trustedperm:
- fprint(debugfd, "\tPerm Trustedfile: %I", &np->ip);
+ fprint(debugfd, "\tPerm Trustedfile: %I %M", np->ip.ipaddr, np->ip.mask);
break;
case Trustedtemp:
- fprint(debugfd, "\tTemp Trustedfile: %I", &np->ip);
+ fprint(debugfd, "\tTemp Trustedfile: %I %M", np->ip.ipaddr, np->ip.mask);
break;
case Ctlfile:
fprint(debugfd, "\tCtlfile");
@@ -301,18 +300,3 @@ printtree(Node *np)
for (np = np->children; np; np = np->sibs)
printtree(np);
}
-
-static int
-ipconv(Fmt *f)
-{
- Cidraddr *ip;
- int i, j;
- char *p;
-
- ip = va_arg(f->args, Cidraddr*);
- p = (char*)&ip->ipaddr;
- i = 0;
- for (j = ip->mask; j; j <<= 1)
- i++;
- return fmtprint(f, "%d.%d.%d.%d/%d", p[3]&0xff, p[2]&0xff, p[1]&0xff, p[0]&0xff, i);
-}