Commit graph

277 commits

Author SHA1 Message Date
cinap_lenrek b7c05975f5 ip/torrent: avoid peerid collision using truerand() instead of time(0) 2017-03-20 19:11:03 +01:00
cinap_lenrek 963cfc9a6f merging erik quanstros nupas 2017-03-12 17:15:03 +01:00
aiju 55373a6498 ip/ipconfig: don't null terminate the dhcp string options.
this seems to be an anachronism; few modern clients put the null in and RFC 2132 says clients 'SHOULD NOT' null terminate
2017-02-19 22:53:10 +00:00
cinap_lenrek abda59c7ec ip/gping: fix corruption due to Machine.last pointer not being maintained in pingclean(), cleanup unused stuff 2017-02-19 02:27:42 +01:00
cinap_lenrek 486523bbc5 ip/ipconfig: have to refresh /net/cs, /net/dns after ndbconfig even tho /net/ndb didnt got written 2017-02-06 11:19:45 +01:00
cinap_lenrek f94167ebee ip/ipconfig: don't write /net/ndb when getting config from ndb (-N) 2017-02-02 22:00:51 +01:00
cinap_lenrek a0d4c5e208 make error handling in 9p service loops consistent
when we get eof, stop the loop immidiately and do not
rely on the read to eventually return an error.

when convM2S() fails to decode the message, error out
and stop the loop. there is no point in continuing.
2016-07-24 02:21:32 +02:00
cinap_lenrek a630e17bd7 ip/ipconfig, ip/ppp: preserve preexisting entries when writing /net/ndb
it is now possible to configure additional interfaces (like wifi)
and store the network information while preserving old entries
in /net/ndb. this allows to easily switch from ethernet to wifi
and have dhcp configure dns without having to clear /net/ndb.
2016-05-08 06:05:25 +02:00
cinap_lenrek e93f7885da 6in4: ingress filter multicast and link-local, but allow relay traffic 2016-03-31 23:53:10 +02:00
cinap_lenrek 137533bd69 6in4: allow setting the local IPv4 address with -i flag (thanks k0ga) 2016-03-31 20:35:02 +02:00
cinap_lenrek d094b7faa1 ip/gping: add main pid to pid list for killall() 2016-03-18 08:59:01 +01:00
cinap_lenrek 7f224a8f6d ppp: fix buffer overflow, set correct state after chap negotiation (thanks k0ga)
(ppp->secret comes from factotum and it can have any size)
This patch also sets the correct state after success and
failure cases in chap negotiation (without them the code was
working because it expected the other point to pass to net
phase or due to the timer).
2016-03-15 22:31:03 +01:00
cinap_lenrek 708178e615 ppp: Small format and log fixes (thanks k0ga) 2016-03-15 22:19:19 +01:00
cinap_lenrek bd0f48b357 ppp: md5 and mschap inside chap, do not request encryption with -c or -C (thanks k0ga)
p2.patch: Do not request encriptation with -c or -C in ppp
(it was a bit annoying request compression, and when the ACK
from the server was received then send a NAK).

p3.patch: Add support for md5 and mschap in in chap
(without this patch ppp was passing to the net stage
without worring about chap).
2016-03-15 22:18:05 +01:00
cinap_lenrek 74d4d8a26e pppoe: Add support for -c and -C to enable/disable header compression (thanks k0ga) 2016-03-15 22:10:54 +01:00
cinap_lenrek 2dddca9847 ip/gping: ignore advice, fix packet corruption check, remove dead code 2016-03-12 23:27:49 +01:00
cinap_lenrek 31c3941e87 ip/gping: set display->locking before starting mouseproc (race) 2016-03-12 21:44:58 +01:00
cinap_lenrek 7314601f9d pppoe: Avoid double free (thanks k0ga)
k0ga reports:

Hello,

While I was setting my pppoe conexion with my ISP
I discovered several problems in ip/pppoe. I used
the command line ip/pppoe -A '' ether0 and I got
this:

...
dropping unwanted pkt: wrong ac name
panic: D2B called on non-block dc10 (double-free?)
note rcved: sys: trap: fault read addr=0x0 pc=0x000066e1
pppoe 1013: suicide: sys: trap: fault read addr=0x0 pc=0x000066e1
cpu% acid 1013
/proc/1013/text:386 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/386
acid: stk()
abort()+0x0 /sys/src/libc/9sys/abort.c:6
ppanic(p=0xd1b8,fmt=0xc7f9)+0x146 /sys/src/libc/port/malloc.c:166
D2B(p=0xd1b8,v=0xdc10)+0x57 /sys/src/libc/port/pool.c:926
poolfreel(v=0xdc10,p=0xd1b8)+0x20 /sys/src/libc/port/pool.c:1152
poolfree(p=0xd1b8,v=0xdc10)+0x3b /sys/src/libc/port/pool.c:1287
free(v=0xdc18)+0x23 /sys/src/libc/port/malloc.c:250
clearstate()+0x1b /sys/src/cmd/ip/pppoe.c:328
pppoe(ether=0xdfffefc1)+0x123 /sys/src/cmd/ip/pppoe.c:426
main(argv=0xdfffefa0,argc=0x1)+0x89 /sys/src/cmd/ip/pppoe.c:100
_main+0x31 /sys/src/libc/386/main9.s:16
acid:


clearstate() is called in pppoe.c:424, and it frees acname and sets it
to nil.  pktread() is called in pppoe.c:434 with parameter wantoffer,
which frees acname again in line pppoe.c:360 but doesn't set it to
nil, so clearstate() makes a double free in the next iteration.
2016-03-01 23:54:37 +01:00
cinap_lenrek 772afbe98c format pointer subtraction results with %zd instead of %ld (for long -> intptr on amd64) 2016-01-07 04:44:13 +01:00
cinap_lenrek 46bbeea040 snoopy: fix timestamps for pcap files (thanks BurnZeZ)
the pcap files produced by snoopy had the wrong timestamps because it expected:

/* magic=0xa1b2c3d4 */
ulong ts_sec;	/* seconds*/
ulong ts_usec;	/* microseconds */

but we wrote:

uvlong ts;		/* nanoseconds */

now, we write:

/* magic=0xa1b23c4d */
ulong ts_sec;	/* seconds */
ulong ts_nsec;	/* nanoseconds */
2015-12-23 02:00:09 +01:00
glenda c4fdc6bfdb fix fuckup 2015-08-25 09:35:10 +00:00
mischief 6b402b83cf import E script from bell labs 2015-08-25 02:07:46 -07:00
cinap_lenrek 0d93e2fe70 snoopy: dont rely on atoi() being able to parse hex 2015-08-03 14:58:41 +02:00
cinap_lenrek ab4b7c2573 ip/httpfile: fix flushes, fix concurrent reads, set error string
Tflush handling was wrong, we cannot respond to the old
request if we have not actually removed the req from the
in progress block queue.

when reads are issued concurrently, we have to set b->len
before the block is inserted into the inprogress list.
otherwise findblock() is unable to find it and no requests
can be queued on the block. this caused the same offset
to be downloaded multiple times.

set the errstr in getrange() so in case of an error, we dont
get some random previous error string.
2015-07-23 03:24:39 +02:00
cinap_lenrek 41372f346a httpfile: fix evictblock() so we wont consume all the memory 2015-07-13 05:51:04 +02:00
cinap_lenrek 1d5a2aa487 tftpd: count only options we understand so we wont send empty oack message 2015-07-11 02:35:49 +02:00
cinap_lenrek 036ae2e397 cifsd: smbrename is still ok when file is readonly (fixed git) 2015-06-10 17:18:31 +02:00
mischief a94a8a06de revert httpd log file goof 2015-05-20 18:16:54 -07:00
mischief a1bbf39c34 ip/httpd: fix syslog file 2015-05-20 15:38:56 -07:00
cinap_lenrek 4d0343c9d2 dhcpd: ignore ";" filename from sgi arcs bootp(); command 2015-03-18 19:52:31 +01:00
cinap_lenrek 757354dac6 imap4d: simplify auth code using encodefmt(), use readn() to get multiple of 3*18 in base64 input buffer 2015-03-12 17:29:17 +01:00
mischief a4650bdf83 ip/ipconfig: set ndb database file with -f argument 2015-01-10 11:27:45 -08:00
cinap_lenrek 7f5f69ebb5 socksd: revert back, previous commit broke UdpAssociate request
should probably figure out a better way to get public ip
address on a interface.
2014-12-26 11:41:53 +01:00
cinap_lenrek de349cf9b0 socksd: dont use myipaddr() for announcing address 2014-12-26 09:11:04 +01:00
mischief ee2d30984f ip/ipconfig: treat /32 mask as /0
some dhcp servers send a mask of 255.255.255.255 to indicate the gateway is directly routeable.

thanks to david du colombier for this patch.
2014-12-08 17:27:40 -08:00
cinap_lenrek c79dc3263e httpfile: use webfs, fix 9p flushes
we can improve performance alot by using webfs which
does http keep alives for us, so connection setup
overhead is eleminated.

fix 9p flushes and double frees.
2014-11-12 12:03:51 +01:00
cinap_lenrek 797cc13c70 fix dangerous werrstr() usages
werrstr() takes a format string as its first argument.
a common error is to pass user controlled string buffers
into werrstr() that might contain format string escapes
causing werrstr() to take bogus arguments from the stack
and crash.

so instead of doing:
	werrstr(buf);

we want todo:
	werrstr("%s", buf);

or if we have a local ERRMAX sized buffer that we can override:
	errstr(buf, sizeof buf);
2014-11-07 12:51:59 +01:00
cinap_lenrek 840ade48c4 fix syslog() use with linefeeds for various programs 2014-10-29 17:29:09 +01:00
cinap_lenrek 7f295c2055 telnetd: let the kernel place the shared segment in segattach() (thanks kenji arisawa) 2014-09-14 21:20:13 +02:00
cinap_lenrek a49ddece8b ip/ayiya: experimental anything in anything tunnel protocol client
this is a work in progress implementation of the ayiya (anything
in anything) protocol as used by sixxs.net. hiro tested it and it
worked for him, but progress has stalled as sixxs.net rejected my
request for an account and ignored my emails since.
2014-09-06 22:59:58 +02:00
cinap_lenrek 7996878864 ipconfig: remove sleep() left over from debug :-) 2014-08-27 01:41:02 +02:00
cinap_lenrek 46b8a0ac00 ipconfig: fix readipifc() memory leaks in recvra6 and sendra6 processes
to avoid continuously leaking memory in recvra6 and sendra6
processes, pass the previous Ipifc* pointer to readipifc().
2014-08-27 01:12:42 +02:00
cinap_lenrek 7ad08a8515 ipconfig: cleanup code duplication in ip6cfg() 2014-08-26 21:09:57 +02:00
cinap_lenrek dbf165e1bd ping: don't spin when we get error reading icmp connection, print error and sleep 2014-08-26 21:07:59 +02:00
cinap_lenrek 7ae4e473da ftpfs: dont convert names to latin when string is valid utf-8 2014-08-02 14:37:16 +02:00
cinap_lenrek cc001c31a7 tftpfs: make sure path is null terminated 2014-07-13 01:17:48 +02:00
cinap_lenrek 4b7b1218bf ftpd: dont skip unmountnet() and return proper error string from dialdata() 2014-07-13 01:03:17 +02:00
cinap_lenrek e14eaacce6 tftpd: fix error string packet overflow in nak(), fix syslog reporting 2014-07-13 01:00:02 +02:00
cinap_lenrek 7ae98ac5a6 ip/torrent: use "torrent" as default user agent 2014-05-19 04:56:07 +02:00
cinap_lenrek 1055b951f3 ip/torrent: fix usage, add -A option to set user-agent
trackers do like the new default Mozilla/5.0 (compatible)
user agent. so force useragent to hjdicks and give option
to override it in case trackers get even more clever in
the future.
2014-05-19 23:23:08 +02:00
cinap_lenrek c994152a90 ipconfig: fix dhcp watch
in dhcpwatch, the sleep time "secs" could become
zero potentially freezing the lease time.

give up when in Sinit state in dhcpquery() as this
is a terminal state.
2014-05-18 19:20:31 +02:00
ftrvxmtrx d2c3185bfa fix threadsetname usage in few places 2014-05-03 13:07:52 +02:00
cinap_lenrek 82cec6f585 socksd: close inside udp server one we get a connection (udprelay) 2014-02-14 14:57:05 +01:00
cinap_lenrek 81ea3f24fa cifsd: fix compiler warning 2014-02-14 14:21:07 +01:00
cinap_lenrek 80deec0a7b ip/torrent: remove unneeded assignment 2014-02-14 14:12:02 +01:00
mischief abb4bad701 ip/torrent: print tracker errors/warnings in debug mode and allow setting peerid 2014-02-01 12:04:30 -08:00
cinap_lenrek c940e98630 experimental ntlmv2 server authenticaion support for cifsd
extending factotums and the auth servers mschap implementation
to handle variable length NT response for NTLMv2.

fix some minor bugs.

only tested with cifs so far.
2013-12-08 02:22:12 +01:00
cinap_lenrek f6887b0a3c telnet: simplify previous change by moving the notkbd check into consctlcmd() 2013-12-05 22:43:44 +01:00
cinap_lenrek 919863dab3 telnet: disable changing raw mode when a pipe was being used (from sources telnet-notkbd patch)
This patch corrects a minor problem with telnet when using
the notkbd option (-n).
2013-12-05 22:05:57 +01:00
cinap_lenrek 50e3c936fa ip/torrent: check piece offset, vlong cast 2013-10-08 08:12:05 +02:00
cinap_lenrek 3c2b09c9dc ip/torrent: more checking, backoff from piece on hash error 2013-10-08 07:55:26 +02:00
cinap_lenrek 56836bfdbd tls: fix various tlsClient()/tlsServer() related bugs
- TLSconn structure on stack but not initialized (zeroed)
- original filedescriptor double closed in error case
- original filedescriptor leaked in success case
- leaked TLSconn.sessionID and TLSconn.cert
- clarify in pushtls(2) and pushssl(2)
2013-09-14 19:19:08 +02:00
cinap_lenrek d76eccaf88 imap4d: apply djc's patch to fix search (from /n/sources/patch/imap4d-cistrcmp)
Fix SEARCH command in imap4d by replacing the cistrstr typo with cistrcmp.
2013-08-27 00:34:17 +02:00
cinap_lenrek 508b53a29a libdraw: fix leftover processes or programs failing to restore window labels when receiving interrupt note
fix the default note handler for event programs. only handle non system
notes or notes in the slave processes. for interrupt in the main process,
just call exits() which will do the cleanup and restore window label
properly.

this makes completely overriding the note handler in gping and
stats uneccesary.
2013-08-13 21:46:13 +02:00
cinap_lenrek e36d9f5c4e make filesystem handling of read9pmsg() consistent 2013-06-16 06:26:31 +02:00
cinap_lenrek e9c8ef5e16 ftpd: "opts utf8 on" 2013-04-23 19:37:56 +02:00
cinap_lenrek 8858fdf15f ftpd: fix nil pointer derefernece when ominiting arguments to opts command 2013-04-23 22:47:27 +02:00
cinap_lenrek 922d6d0780 ftpd: implement "OPTS UTF-8 ON", fix uninitialized printing uninitialized memory in HELP command 2013-04-23 22:38:03 +02:00
cinap_lenrek c04297587c ip/torrent: use NPROC processes in parallel for calculating initial piece hashes 2013-04-20 22:47:39 +02:00
ftrvxmtrx 0f2caad8b6 ftpfs: fix wrong comment 2013-02-17 12:32:50 +01:00
ftrvxmtrx b8990cfbb4 ftpfs: do not call getfields after NLST 2013-02-16 22:06:26 +01:00
cinap_lenrek 029a8087a3 httpd: fix rane requests
we gave wrong content-length in range requests. r->stop - r->start
is wrong because r->stop is the byte offset of the *last* byte, not
the *next* byte after the last.
2013-01-31 22:51:21 +01:00
cinap_lenrek e53ece53ed httpfile: fix range requests
byte ranges use closed intervals (inclusive first
and last byte offsets)
2013-01-31 22:48:56 +01:00
cinap_lenrek 3787f721c1 9p message size too small
various fileservers do not check if the message size is too small
(they subtract IOHDRSZ later from it to calculate iounit) which
can overflow.
2013-01-30 06:28:42 +01:00
cinap_lenrek f2f2c8687a 6in4: add -o option to make it possible to use different nets for ipv6 and ipv4 interface 2013-01-14 07:09:25 +01:00
cinap_lenrek 6cadd03bbe fix utf and rune handling in preparation for 32bit runes 2012-12-31 21:09:46 +01:00
cinap_lenrek 44ac7fe940 6in4: use localmask instead of hardcoded /128 when adding address to interface 2012-12-21 19:18:47 +01:00
cinap_lenrek 2c1c1e4005 hproxy: fix ipv6 url parsing 2012-12-20 22:15:52 +01:00
cinap_lenrek 49c8aed2db ip/ipconfig: automatically find ethernet device on /net if not given 2012-12-05 14:38:30 +01:00
cinap_lenrek 5cddd21627 cifsd: fix 64bit fileoffset bug
the low 32bit word got *sign-extended* on vlong conversion. m(
2012-10-11 21:38:54 +02:00
cinap_lenrek d9394b0d87 6in4: fix exit status, less strict src filtering, logging (import from sources) 2012-10-11 13:21:30 +02:00
cinap_lenrek 61d1967e74 tftpfs: add manpage, add -x option 2012-10-06 04:14:48 +02:00
cinap_lenrek 9a06f93b71 tftp: prevent it from hanging if ack packets get lost
send ACK reply for duplicate data packets in case our ack response
got lost. make sure packets are in sequence and ignore out of
oder packets (except the ones we'v already acked).
2012-09-20 09:33:40 +02:00
cinap_lenrek 913afc39c9 tftpd: apply sstallion's tftpd-rfc patch (from sources)
tftpd option handling is not RFC-compliant. This causes picky
clients (such as curl) to fail transfers.
2012-09-18 18:27:59 +02:00
cinap_lenrek 37a93ef857 ppp: noauth server option (import from sources) 2012-08-07 15:57:42 +02:00
aiju e2270b09f3 fixed telnetd 2012-08-04 14:52:29 +02:00
cinap_lenrek 115f14f144 hproxy: force connection close 2012-07-06 16:02:44 +02:00
cinap_lenrek b811bb8876 add hproxy to mkfile 2012-07-06 15:51:19 +02:00
cinap_lenrek fdfce9d864 hproxy: simple http proxy server 2012-07-06 15:49:33 +02:00
cinap_lenrek 326c8d9c42 ip/torrent: simplify 2012-05-06 18:00:15 +02:00
cinap_lenrek 3997c57b57 ip/torrent: keep peers in queue 2012-05-06 17:38:20 +02:00
cinap_lenrek ab022ff67d ip/torrent: fix mistake 2012-05-06 16:44:09 +02:00
cinap_lenrek 8943c2fb8a ip/torrent: limit number of connections 2012-05-06 16:33:17 +02:00
cinap_lenrek 0c0b874d49 ip/torrent: cleanup 2012-04-27 03:46:07 +02:00
cinap_lenrek d899f9cfc6 ip/torrent: udp tracker support 2012-04-27 03:05:16 +02:00
cinap_lenrek 0baa5c7cbe ip/torrent: alphabetically order dictionary keys when producing torrent 2012-04-24 23:50:08 +02:00
cinap_lenrek 95d7fa1c0e ip/torrent: more cleanup, error handling for webseed 2012-04-16 13:29:41 +02:00
cinap_lenrek bb58166162 ip/torrent: cleanup 2012-04-16 01:40:46 +02:00
cinap_lenrek fd02ddae19 ip/torrent: webseed support 2012-04-16 00:50:25 +02:00
cinap_lenrek 53511a9097 ip/torrent: create announce-list torrents 2012-04-15 19:26:04 +02:00
cinap_lenrek 9cb700018a ipconfig: remove 6 minute redundant dhcp retry timeout 2012-03-29 01:11:22 +02:00
cinap_lenrek e7c89b6ab4 socksd: setnetmtpt 2012-03-15 23:20:56 +01:00
cinap_lenrek 25b63636a0 socksd: udp RSV and FRAG must be zero 2012-03-11 18:18:59 +01:00
cinap_lenrek 81fb4d22e2 socksd: udp relay support 2012-03-11 17:43:47 +01:00
cinap_lenrek 3e71d1af48 tftpfs: let kernel choose local udp port 2012-03-11 17:36:41 +01:00
cinap_lenrek 51a43ed5c5 socksd: support for BIND command 2012-03-11 09:13:49 +01:00
cinap_lenrek c9d2ce7b1c ftpd: import changes from sources 2012-03-09 06:07:20 +01:00
cinap_lenrek 731aeeedb3 tftpd: import from sources 2012-03-09 06:06:33 +01:00
cinap_lenrek fa74649d18 socksd: use note to shoot down relay procs 2012-03-02 06:40:40 +01:00
cinap_lenrek 2fec3c0bc8 socksd: socks4 and socks4a support 2012-03-02 04:32:46 +01:00
cinap_lenrek a57252cadb socksd: simple socks server (no manpage yet) 2012-03-02 00:34:41 +01:00
cinap_lenrek b15accceac cifsd: send SMB_COM_NEGOTIATE response like NT 2012-01-15 22:24:50 +01:00
cinap_lenrek c11bed9f41 cifsd: handle bogus MaxCount in read, wstat archive attribute 2012-01-15 14:31:27 +01:00
cinap_lenrek 260fcc61c0 fix wrong use of qid.type == QTDIR comparsion 2012-01-12 15:15:25 +01:00
cinap_lenrek 797ba8e6ff telnet: dont fiddle with consctl when posting svc, cleanup 2011-12-15 16:31:56 +01:00
cinap_lenrek fa4dd2f2fe ip/gping: honor $font instead of hardcoding 2011-12-09 21:27:22 +01:00
cinap_lenrek 83865180a2 torrent: calculate piece length depending on file size 2011-10-25 14:55:24 +02:00
cinap_lenrek d8bde8f7b3 torrent: fix \0 escaping bug, add -c option to create new torrents 2011-10-25 14:09:41 +02:00
cinap_lenrek 1c31521e2d torrent: fix trailing amp in announce url 2011-10-24 19:24:47 +02:00
cinap_lenrek d0889d1c3c torrent: create directories for multifile torrents 2011-10-24 17:12:57 +02:00
cinap_lenrek f5fe39ad7a torrent: listen support 2011-10-24 00:53:27 +02:00
cinap_lenrek bba834adee ip/torrent: add minimalistic BitTorrent client 2011-10-23 00:55:56 +02:00
cinap_lenrek 8bc1aa6127 add ip/tftpfs 2011-05-15 20:08:42 +00:00
cinap_lenrek 4b550911d9 add cifsd 2011-05-09 10:42:20 +00:00
cinap_lenrek 7dfb8b6ec5 replace aquarela with ip/cifsd 2011-05-09 10:38:45 +00:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00