summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@rei2.9hal>2012-03-11 17:36:41 +0100
committercinap_lenrek <cinap_lenrek@rei2.9hal>2012-03-11 17:36:41 +0100
commit3e71d1af48b960a87469c002240f9704f1643685 (patch)
tree46f039beea11f48063910d08c7975c8045bdac68
parent51a43ed5c5065c07233e9401297ff3947a158f97 (diff)
downloadplan9front-3e71d1af48b960a87469c002240f9704f1643685.tar.xz
tftpfs: let kernel choose local udp port
-rw-r--r--sys/src/cmd/ip/tftpfs.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/sys/src/cmd/ip/tftpfs.c b/sys/src/cmd/ip/tftpfs.c
index 6e2264982..2e48d6cb4 100644
--- a/sys/src/cmd/ip/tftpfs.c
+++ b/sys/src/cmd/ip/tftpfs.c
@@ -123,13 +123,6 @@ catch(void *, char *msg)
}
static int
-newport(void)
-{
- static int port;
- return 5000+(port++)%64;
-}
-
-static int
filereq(uchar *buf, char *path)
{
uchar *p;
@@ -155,7 +148,7 @@ static void
download(void *aux)
{
int fd, cfd, last, block, n, ndata;
- char *err, addr[40], adir[40];
+ char *err, adir[40];
uchar *data;
Channel *c;
Tfile *f;
@@ -180,12 +173,7 @@ download(void *aux)
threadsetname(f->path);
- for(n=0; n<10; n++){
- snprint(addr, sizeof(addr), "udp!*!%d", newport());
- if((cfd = announce(addr, adir)) >= 0)
- break;
- }
- if(cfd < 0){
+ if((cfd = announce("udp!*!0", adir)) < 0){
err = "announce: %r";
goto out;
}
@@ -440,7 +428,7 @@ void
threadmain(int argc, char **argv)
{
char *srvname = nil;
- char *mtpt = nil;
+ char *mtpt = "/n/tftp";
time0 = time(0);
ipmove(ipaddr, IPnoaddr);
@@ -451,6 +439,7 @@ threadmain(int argc, char **argv)
break;
case 's':
srvname = EARGF(usage());
+ mtpt = nil;
break;
case 'm':
mtpt = EARGF(usage());