summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2008-10-26 12:36:58 +0000
committerCharles.Forsyth <devnull@localhost>2008-10-26 12:36:58 +0000
commita5e7f7282341dff49881e8b7ce247b44fd8bcc7e (patch)
treea14b91bfba0c4fda410a4c6f8f43c03ff2dfa917
parent85d064cb246ab6d3b9e19dca711bb4167f8aa1cf (diff)
20081026-1236
-rw-r--r--appl/cmd/ndb/cs.b16
-rw-r--r--dis/ndb/cs.disbin9654 -> 9820 bytes
2 files changed, 13 insertions, 3 deletions
diff --git a/appl/cmd/ndb/cs.b b/appl/cmd/ndb/cs.b
index 1506e9ba..d808f118 100644
--- a/appl/cmd/ndb/cs.b
+++ b/appl/cmd/ndb/cs.b
@@ -193,7 +193,7 @@ sysname(): string
if(t == nil){
s := rf(mntpt+"/ndb");
if(s != nil){
- db := Db.sopen(t);
+ db := Db.sopen(s);
if(db != nil){
(e, nil) := db.find(nil, "sys");
if(e != nil)
@@ -212,7 +212,7 @@ sysname(): string
rf(name: string): string
{
fd := sys->open(name, Sys->OREAD);
- buf := array[Sys->NAMEMAX] of byte;
+ buf := array[512] of byte;
n := sys->read(fd, buf, len buf);
if(n <= 0)
return nil;
@@ -465,11 +465,21 @@ xlate(address: string, now: int): (list of string, string)
while(l != nil) {
s := hd l;
l = tl l;
+ dnetw := netw;
+ if(s != nil){
+ (divert, err) := ipattr->findnetattr(ndb, "ip", s, "divert-"+netw);
+ if(err == nil && divert != nil){
+ dnetw = divert;
+ if(!isnetwork(dnetw))
+ return (nil, "network unavailable "+dnetw); # XXX should only give up if all addresses fail?
+ }
+ }
+
if(s != "")
s[len s] = '!';
s += service;
- repl = mntpt+"/"+netw+"/clone "+s;
+ repl = mntpt+"/"+dnetw+"/clone "+s;
if(verbose)
sys->fprint(stderr, "cs: %s!%s!%s -> %s\n", netw, mach, service, repl);
diff --git a/dis/ndb/cs.dis b/dis/ndb/cs.dis
index fe55281c..674cce07 100644
--- a/dis/ndb/cs.dis
+++ b/dis/ndb/cs.dis
Binary files differ