diff options
| author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-02-06 11:19:45 +0100 |
|---|---|---|
| committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-02-06 11:19:45 +0100 |
| commit | 486523bbc57b111d198432d2416e598c6d5c2d63 (patch) | |
| tree | 08a0a513919ca878aa66e2513305dec435fccda2 | |
| parent | bbce9c0566da28911f0ce444d0fdca0fe4eb77b9 (diff) | |
| download | plan9front-486523bbc57b111d198432d2416e598c6d5c2d63.tar.xz | |
ip/ipconfig: have to refresh /net/cs, /net/dns after ndbconfig even tho /net/ndb didnt got written
| -rw-r--r-- | sys/src/cmd/ip/ipconfig/ipconfig.h | 1 | ||||
| -rw-r--r-- | sys/src/cmd/ip/ipconfig/main.c | 40 |
2 files changed, 27 insertions, 14 deletions
diff --git a/sys/src/cmd/ip/ipconfig/ipconfig.h b/sys/src/cmd/ip/ipconfig/ipconfig.h index 0f44129c8..cbc7e0adc 100644 --- a/sys/src/cmd/ip/ipconfig/ipconfig.h +++ b/sys/src/cmd/ip/ipconfig/ipconfig.h @@ -132,6 +132,7 @@ int parseoptions(uchar *p, int n); int parseverb(char*); void procsetname(char *fmt, ...); void putndb(void); +void refresh(void); ulong randint(ulong low, ulong hi); void usage(void); int validip(uchar*); diff --git a/sys/src/cmd/ip/ipconfig/main.c b/sys/src/cmd/ip/ipconfig/main.c index 11b9896a7..06a9bfee0 100644 --- a/sys/src/cmd/ip/ipconfig/main.c +++ b/sys/src/cmd/ip/ipconfig/main.c @@ -648,8 +648,11 @@ doadd(int retry) dhcpwatch(0); /* leave everything we've learned somewhere other procs can find it */ - if(beprimary && !dondbconfig) - putndb(); + if(beprimary){ + if(!dondbconfig) + putndb(); + refresh(); + } } void @@ -991,8 +994,10 @@ dhcpwatch(int needconfig) * leave everything we've learned somewhere that * other procs can find it. */ - if(beprimary) + if(beprimary){ putndb(); + refresh(); + } } } } @@ -1641,6 +1646,24 @@ putaddrs(char *p, char *e, char *attr, uchar *a, int len) return p; } +void +refresh(void) +{ + char file[64]; + int fd; + + snprint(file, sizeof file, "%s/cs", conf.mpoint); + if((fd = open(file, OWRITE)) >= 0){ + write(fd, "refresh", 7); + close(fd); + } + snprint(file, sizeof file, "%s/dns", conf.mpoint); + if((fd = open(file, OWRITE)) >= 0){ + write(fd, "refresh", 7); + close(fd); + } +} + /* make an ndb entry and put it into /net/ndb for the servers to see */ void putndb(void) @@ -1699,17 +1722,6 @@ putndb(void) return; write(fd, buf, p-buf); close(fd); - - snprint(file, sizeof file, "%s/cs", conf.mpoint); - if((fd = open(file, OWRITE)) >= 0){ - write(fd, "refresh", 7); - close(fd); - } - snprint(file, sizeof file, "%s/dns", conf.mpoint); - if((fd = open(file, OWRITE)) >= 0){ - write(fd, "refresh", 7); - close(fd); - } } /* return number of networks */ |
