make ftpd restart beyond 2G
The only limit was in the command parser. Tested with FIleZilla Client and wget -c ftp: Index: ftpcmd.y === RCS file: /cvs/src/libexec/ftpd/ftpcmd.y,v retrieving revision 1.55 diff -u -p -u -r1.55 ftpcmd.y --- ftpcmd.y27 Nov 2013 21:25:25 - 1.55 +++ ftpcmd.y27 Dec 2013 11:47:43 - @@ -96,7 +96,7 @@ char *fromname; %} %union { - int i; + off_t i; char *s; } @@ -663,7 +663,7 @@ rcmd free(fromname); fromname = NULL; } - restart_point = $4; /* XXX $4 is only int */ + restart_point = $4; reply(350, Restarting at %qd. %s, restart_point, Send STORE or RETRIEVE to initiate transfer.); @@ -1318,7 +1318,7 @@ yylex() ; c = cbuf[cpos]; cbuf[cpos] = '\0'; - yylval.i = atoi(cp); + yylval.i = atoll(cp); cbuf[cpos] = c; state = STR1; return (NUMBER); @@ -1333,7 +1333,7 @@ yylex() ; c = cbuf[cpos]; cbuf[cpos] = '\0'; - yylval.i = atoi(cp); + yylval.i = atoll(cp); cbuf[cpos] = c; return (NUMBER); }
PATCH: fix bug in handling genmask
maybe someone could verify commit this patch a. fix a bug b. get rid of junk in ‘mask_rnhead' c. forbid unprivileged user to insert mask into ‘mask_rnhead' bug is in this line Bcmp((caddr_t *)genmask + 1, (caddr_t *)t-rn_key + 1, ((struct sockaddr *)t-rn_key)-sa_len) to make this right, at least, it should look like this Bcmp((caddr_t)genmask + 1, (caddr_t)t-rn_key + 1, ((struct sockaddr *)t-rn_key)-sa_len - 1) after doing this, the whole checking seems completely unnecessary, is expected result from ‘rn_addmask’. Index: net/rtsock.c === RCS file: /cvs/src/sys/net/rtsock.c,v retrieving revision 1.131 diff -p -u -r1.131 rtsock.c --- net/rtsock.c1 Nov 2013 20:09:14 - 1.131 +++ net/rtsock.c27 Dec 2013 14:08:44 - @@ -593,18 +593,22 @@ route_output(struct mbuf *m, ...) error = EINVAL; goto flush; } - if (genmask) { - struct radix_node *t; - t = rn_addmask(genmask, 0, 1); - if (t genmask-sa_len = - ((struct sockaddr *)t-rn_key)-sa_len - Bcmp((caddr_t *)genmask + 1, (caddr_t *)t-rn_key + 1, - ((struct sockaddr *)t-rn_key)-sa_len) - 1) - genmask = (struct sockaddr *)(t-rn_key); - else { + if (genmask rtm-rtm_type != RTM_GET) { + if (!(rnh = rt_gettable(dst-sa_family, tableid))) { + error = EINVAL; + goto flush; + } + if (!(rn = rn_addmask(genmask, 0, rnh-rnh_treetop-rn_off))) { error = ENOBUFS; goto flush; } + if (!((struct sockaddr *)rn-rn_key)-sa_len) { + error = EINVAL; + goto flush; + } + genmask = (struct sockaddr *)rn-rn_key; + } else { + genmask = NULL; } #ifdef MPLS info.rti_mpls = rtm-rtm_mpls;
PATCH: fix bug in handling genmask
re-send this patch, loop in claudio@ maybe someone could verify commit this patch a. fix a bug b. get rid of junk in ‘mask_rnhead' c. forbid unprivileged user to insert mask into ‘mask_rnhead' bug is in this line Bcmp((caddr_t *)genmask + 1, (caddr_t *)t-rn_key + 1, ((struct sockaddr *)t-rn_key)-sa_len) to make this right, at least, it should look like this Bcmp((caddr_t)genmask + 1, (caddr_t)t-rn_key + 1, ((struct sockaddr *)t-rn_key)-sa_len - 1) after doing this, the whole checking seems completely unnecessary, is expected result from ‘rn_addmask’. Index: net/rtsock.c === RCS file: /cvs/src/sys/net/rtsock.c,v retrieving revision 1.131 diff -p -u -r1.131 rtsock.c --- net/rtsock.c1 Nov 2013 20:09:14 - 1.131 +++ net/rtsock.c27 Dec 2013 14:08:44 - @@ -593,18 +593,22 @@ route_output(struct mbuf *m, ...) error = EINVAL; goto flush; } - if (genmask) { - struct radix_node *t; - t = rn_addmask(genmask, 0, 1); - if (t genmask-sa_len = - ((struct sockaddr *)t-rn_key)-sa_len - Bcmp((caddr_t *)genmask + 1, (caddr_t *)t-rn_key + 1, - ((struct sockaddr *)t-rn_key)-sa_len) - 1) - genmask = (struct sockaddr *)(t-rn_key); - else { + if (genmask rtm-rtm_type != RTM_GET) { + if (!(rnh = rt_gettable(dst-sa_family, tableid))) { + error = EINVAL; + goto flush; + } + if (!(rn = rn_addmask(genmask, 0, rnh-rnh_treetop-rn_off))) { error = ENOBUFS; goto flush; } + if (!((struct sockaddr *)rn-rn_key)-sa_len) { + error = EINVAL; + goto flush; + } + genmask = (struct sockaddr *)rn-rn_key; + } else { + genmask = NULL; } #ifdef MPLS info.rti_mpls = rtm-rtm_mpls;
Re: bus_dmamap_sync semantics
Ok On 27/12/2013 5:28 am, Mark Kettenis mark.kette...@xs4all.nl wrote: Our bus_dmamap(9) man page says: On platforms which implement reordered stores, bus_dmamap_sync() will always cause the store buffer to be flushed. In 2003 NetBSD actually changed that to: On platforms which implement a weak memory access ordering model, bus_dmamap_sync() will always cause the appropriate memory barriers to be issued. While the new wording is a bit ambiguous, it probably makes more sense than what we currently have. Always flushing store buffers doesn't really make sense, especially on BUS_DMASYNC_POSTREAD and BUS_DMASYNC_POSTWRITE operations. It just happens to be what the alpha implementation does (which is where the bus_dma(9) API started). But on sparc64 we certainly don't do this. Do people agree? If so, I'll adjust the wording in the man page.