diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2018-09-13 22:15:42 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2018-09-13 22:15:42 +0200 |
commit | 08385e66816940b999a5c433a1feef303cea67e4 (patch) | |
tree | 6b6205c55670e409d3dc3ea4c18baddfb6c3f7f9 /sys | |
parent | a33d76f8c95d33d6590dd185a2200f06cef014c7 (diff) |
ip/tftpd: remove sunkernel hack
Diffstat (limited to 'sys')
-rw-r--r-- | sys/man/8/dhcpd | 16 | ||||
-rw-r--r-- | sys/src/cmd/ip/tftpd.c | 61 |
2 files changed, 1 insertions, 76 deletions
diff --git a/sys/man/8/dhcpd b/sys/man/8/dhcpd index 71b6b2ffe..7c36c5385 100644 --- a/sys/man/8/dhcpd +++ b/sys/man/8/dhcpd @@ -279,21 +279,7 @@ Change directory to The default is .BR /lib/tftpd . All requests for files with non-rooted file names are served starting at this -directory with the exception of files of the form -.BR xxxxxxxx.SUNyy . -These are Sparc kernel boot files where -.B xxxxxxxx -is the hex IP address of the machine requesting the kernel and -.B yy -is an architecture identifier. -.I Tftpd -looks up the file in the network database using -.I ipinfo -(see -.IR ndb (2)) -and responds with the boot file specified for that particular -machine. -If no boot file is specified, the transfer fails. +directory. .I Tftpd supports only octet mode. .TP diff --git a/sys/src/cmd/ip/tftpd.c b/sys/src/cmd/ip/tftpd.c index bdba24432..f17223dc3 100644 --- a/sys/src/cmd/ip/tftpd.c +++ b/sys/src/cmd/ip/tftpd.c @@ -6,7 +6,6 @@ #include <auth.h> #include <bio.h> #include <ip.h> -#include <ndb.h> enum { @@ -85,7 +84,6 @@ void nak(int, int, char*); void ack(int, ushort); void clrcon(void); void setuser(void); -char* sunkernel(char*); void remoteaddr(char*, char*, int); void doserve(int); @@ -563,14 +561,8 @@ sendfile(int fd, char *name, char *mode, int opts) uchar buf[Maxsegsize+Hdrsize]; char errbuf[ERRMAX]; - file = -1; syslog(dbg, flog, "tftpd %d send file '%s' %s to %s", pid, name, mode, raddr); - name = sunkernel(name); - if(name == 0){ - nak(fd, 0, "not in our database"); - goto error; - } notify(catcher); @@ -755,59 +747,6 @@ setuser(void) sysfatal("can't build namespace: %r"); } -char* -lookup(char *sattr, char *sval, char *tattr, char *tval, int len) -{ - static Ndb *db; - char *attrs[1]; - Ndbtuple *t; - - if(db == nil) - db = ndbopen(0); - if(db == nil) - return nil; - - if(sattr == nil) - sattr = ipattr(sval); - - attrs[0] = tattr; - t = ndbipinfo(db, sattr, sval, attrs, 1); - if(t == nil) - return nil; - strncpy(tval, t->val, len); - tval[len-1] = 0; - ndbfree(t); - return tval; -} - -/* - * for sun kernel boots, replace the requested file name with - * a one from our database. If the database doesn't specify a file, - * don't answer. - */ -char* -sunkernel(char *name) -{ - ulong addr; - uchar v4[IPv4addrlen]; - uchar v6[IPaddrlen]; - char buf[256]; - char ipbuf[128]; - char *suffix; - - addr = strtoul(name, &suffix, 16); - if(suffix-name != 8 || (strcmp(suffix, "") != 0 && strcmp(suffix, ".SUN") != 0)) - return name; - - v4[0] = addr>>24; - v4[1] = addr>>16; - v4[2] = addr>>8; - v4[3] = addr; - v4tov6(v6, v4); - sprint(ipbuf, "%I", v6); - return lookup("ip", ipbuf, "bootf", buf, sizeof buf); -} - void remoteaddr(char *dir, char *raddr, int len) { |