Commit graph

31 commits

Author SHA1 Message Date
kvik e5894dccea pre-lib9p servers: fix incorrect Tversion handling
version(5) says:

	If the server does not understand the client's version
	string, it should respond with an Rversion message (not
	Rerror) with the version string the 7 characters
	``unknown''.

Pre-lib9p file servers -- all except cwfs(4) -- do return Rerror.

lib9p(2) follows the above spec, although ignoring the next part
concerning comparison after period-stripping.  It assumes an
Fcall.version starting with "9P" is correctly formed and returns
the only supported version of the protocol, which seems alright.

This patch brings pre-lib9p servers in accordance with the spec.
2020-08-01 15:27:28 +02:00
cinap_lenrek ac88ce4f7f make bind(2) error handling consistent
The mount() and bind() syscalls return -1 on error,
and the mountid sequence number on success.

The manpage states that the mountid sequence number
is a positive integer, but the kernels implementation
currently uses a unsigned 32-bit integer and does not
guarantee that the mountid will not become negative.

Most code just cares about the error, so test for
the -1 error value only.
2020-05-02 17:32:01 +02:00
cinap_lenrek 19166f2cf3 libc: add procsetname() 2018-09-26 14:56:23 +02:00
cinap_lenrek a4e444f430 libndb: make ndbipinfo() walk ipnet for all matching entries, concatenate and dedup result 2018-09-16 12:39:47 +02:00
cinap_lenrek e4d0a76289 ndb/cs: don't do dns lookups when all we got is loopback or link local addresses 2018-09-09 15:38:53 +02:00
cinap_lenrek 24611cf5ed ndb/cs: add -6 flag for v6 only lookups and "ipv4" control message to toggle v4 lookups. 2018-07-10 19:57:55 +02:00
cinap_lenrek 7113f730de ndb/cs: make ipv6 only host practical by checking ip version on local interfaces
avoid returning ip addresses that cannot be reached due
to lack of a compatible ip address. this means when here
is no ipv4 address configured, we wont return ipv4 addresses
and would not query dns for an A record.

likewise, when here is no ipv6 address configured then
we wont query dns for an AAAA record.

ipv6 lookups can still be disabled with the -4 flag just
as before.
2018-06-01 23:53:09 +02:00
cinap_lenrek 6e284eaad5 ndb/cs: prevent deadlock with ndb/cs by mounting /srv/dns *AFTER* /net
the dnsquery() library function should not start mouting /srv/dns on
its own. this problem arrises only for ndb/cs as it is started before
ndb/dns.

the issue with mounting /srv/dns before /net is when ndb/cs attempts
to read the list of interfaces, accessing /net/ipifc, which triggers
a rpc to ndb/dns as it is ontop of the mount. this can yield a deadlock
when ndb/dns blocks its 9p loop waiting for requests to complete on
a refresh and the requests are stuck waiting for ndb/cs to translate
a dial string for announce().
2018-05-16 21:41:42 +02:00
cinap_lenrek 8e53fe132e ndb/cs: fix crash in ndbredorder due to ndbnew() not maintaining the ->line ring
we have to maintain the ->line chain for ndbreorder() to work, so add
a little helper: ndbline() which replicates the ->entry chain and links
the last tuple to the first; makeing the whole list into a single line.
2018-05-01 22:17:27 +02:00
cinap_lenrek ac962a0ae4 ndb/cs: remove single-ip-address assumptions 2018-04-17 00:45:37 +02:00
cinap_lenrek c4603260f8 ndb/cs: remove paranoia debug toggle 2018-04-14 20:32:26 +02:00
cinap_lenrek b3b938d5ec ndb/cs: handle v4 only case for rudp 2018-01-28 17:58:16 +01:00
cinap_lenrek b12763136e ndb/cs: icmp only supports version 4 addresses, icmpv6 only version 6 addresses 2017-10-04 05:04:33 +02:00
ftrvxmtrx 0930f44feb cmd: remove a bit of unused stuff 2016-11-17 02:59:40 +01:00
cinap_lenrek 75a8003a8a ndb/cs: don't lookup AAAA records for IL, make sure translated address is IPv4 for IL, consistent use of nil vs. 0 for pointers 2016-08-14 23:10:19 +02: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 7468752ea2 ndb/cs: fix memory leak (charles forsyth) 2016-05-16 21:58:12 +02:00
cinap_lenrek 9be64bcb8d ndb/cs: fix spelling (thanks mischief) 2014-12-13 23:16:04 +01:00
cinap_lenrek 4616c93e8d cs: fix linefeeds in syslog(), cleanup 2014-10-29 03:20:43 +01:00
cinap_lenrek fe23dcefd4 cs: use /net/ether* instead /net/ether[0123], dont remove srv file with -n, dont write dns logfile 2014-10-29 02:43:18 +01:00
cinap_lenrek e36d9f5c4e make filesystem handling of read9pmsg() consistent 2013-06-16 06:26:31 +02:00
cinap_lenrek 2e0fac766c ndb/cs, ndb/dns: ignore special commands from users different from the one we run the service owner
this prevents users like "none" from toggling special options in ndb/dns
and ndb/cs.
2013-06-14 19:20:06 +02:00
cinap_lenrek 8f0ec8b725 ndb/dns: fix netmkaddr() race, dnlock consistency, strcpy, cleanups 2012-08-26 01:51:46 +02:00
cinap_lenrek 780d393e4b ndb/cs: limit number of slave procs 2012-07-29 03:05:05 +02:00
cinap_lenrek b4d2e39d8c ndb/cs/dns: make sure never to block the 9p loop when we run out of processes, fail the request instead 2012-07-28 19:17:54 +02:00
cinap_lenrek 1de9ca2de5 bring back il protocol support 2012-05-03 10:47:40 +02:00
stanley lieber 8ff0cd425a ndb/cs: add lookups for ssh 2012-04-28 13:20:37 -05:00
cinap_lenrek 9840c9f18e ndb/cs: fix use after free caused by flush/clunk happening before dns lookup finishes 2012-03-23 04:02:34 +01:00
cinap_lenrek 9b2d3d4266 ndb: avoid double /net/ndb 2012-03-16 22:42:14 +01: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