Commit graph

3133 commits

Author SHA1 Message Date
aiju 830a9b59c9 games/nes: added state saving & bug fixes 2014-02-21 20:48:23 +01:00
cinap_lenrek 0181117b5f fork filter procs with RFREND in various programs 2014-02-21 05:32:20 +01:00
cinap_lenrek fef5c8e4ca aux/listen: rfork with RFREND
child processes handling the connection should be all
independent of each another and not share rendezvous
group. the rendezvous group sharing caused a bug in
exportfs when we switched from using pid to memory
address as rendezvous tag.
2014-02-21 05:29:43 +01:00
cinap_lenrek 40d71baf7f exportfs: bring back the changes, bug was due to rendezvous group being shared by listen
exportfs used pid of slave proc as rendezvous tag. when we
changed it to use Proc* memory address, there where tag
collisions because listen didnt fork the rendezvous group (bug!).

for now, just do rfork(RFREND) in main just in case.

will fix aux/listen in a follow up changeset.

--
cinap
2014-02-21 05:23:21 +01:00
cinap_lenrek d7378c10d8 merge 2014-02-21 01:03:31 +01:00
cinap_lenrek 1281b234e8 exportfs: reverting previous changes
getting strange tag mismatches on some machines. needs
to be debugged. until then, reverting the change.
2014-02-21 01:02:32 +01:00
aiju ce5f4ff032 merge 2014-02-20 22:14:41 +01:00
aiju 29491679b8 games/nes: cleanup and resize handling 2014-02-20 22:13:59 +01:00
aiju eeac553c36 games/nes: bug fixing 2014-02-20 23:22:14 +01:00
cinap_lenrek a6d5f9ccae fix blowfish endianess confusion (thanks erik)
from /n/sources/patch/blowfish/readme:

Blowfish is broken. The order of the bytes in the ciphertext
is wrong. The problem is the conversion from the ciphertext
plaintext block to the array of u32int used by the core funcions
and vice versa.

This code has been tested on big endian and little endian
machines.

A test program is also included, bftets.c. It uses the
test vectors of blowfish available at
https://www.schneier.com/code/vectors.txt
2014-02-20 18:32:47 +01:00
cinap_lenrek 9c40e15ba8 exportfs: fix flush races, proc sweeping 2014-02-18 22:15:06 +01:00
cinap_lenrek 152c9d525b aux/cpuid: hack for amd64 2014-02-17 19:50:02 +01:00
cinap_lenrek 2c5c784255 prof: properly save and restore RARG for amd64
amd64 passes first argument in RARG (BP) register
which has the be preserved duing _profin() and
_profout() calls. to handle this we introduce
_saveret() and _savearg(). _saveret() returns
AX, _savearg() returns RARG (BP). for archs other
and amd64, _saveret() and _savearg() are the
same function, doing nothing.

restoing works with dummy function:

uintptr
_restore(uintptr, uintptr ret)
{
	return ret;
}

...

ret = _saveret();
arg = _savearg();
...
return _restore(arg, ret);

as we pass arg as the first argument, RARG (BP) is
restored.
2014-02-17 13:25:24 +01:00
cinap_lenrek 87fcb107ef games/nes: add mapper 7 support 2014-02-16 21:40:33 +01:00
aap cd27c0cca2 xd: changed -s option to switch to little-endian units 2014-02-16 21:32:14 +01:00
aiju 1225ebec71 added games/nes 2014-02-16 20:51:11 +01:00
cinap_lenrek ae41f49f09 mothra: remove unused local variables from pl_nextc() 2014-02-16 19:40:50 +01:00
cinap_lenrek 3df2b18398 truss: use A instead of X as address format for data dump 2014-02-16 19:20:57 +01:00
cinap_lenrek c44cbf3165 truss: fix syscall address formats 2014-02-16 19:08:49 +01:00
cinap_lenrek 218e1b4b3e mothra: fix unicode rendering for plaintext
we did the utf-8 to unicode conversion in pl_nextc(),
but the plaintext handler uses pl_readc() which only
translates newlines but otherwise returns bytes.

move unicode conversion in pl_readc() fixes it.
2014-02-16 18:50:30 +01:00
Matthew Veety c54271a588 documented usbwait in plan9.ini(8) 2014-02-15 17:18:58 -05:00
cinap_lenrek e42981dfcf factotum/authsrv: fix padding for mschap on amd64, use constants for structure sizes 2014-02-15 19:57:13 +01:00
cinap_lenrek 240ba73770 pc64: fix mistake 2014-02-15 16:58:35 +01:00
cinap_lenrek 25189924db pc64: simplify mmuwalk by factoring out mmu page table creation into separate function 2014-02-15 16:43:55 +01:00
cinap_lenrek c6f6396faa merge 2014-02-15 06:19:25 +01:00
cinap_lenrek ebeb501cff pc64: support for vmware PCnet ethernet 2014-02-15 06:17:38 +01:00
cinap_lenrek 32604cd830 pc64: move VMAP into its own PDP (for vmware)
modifying the kernel pdp (CPU0PDP) hangs vmware. so
we initialize the pdp with KZERO and KZERO+1GB map
in l.s and never change it. (except when removing
the zero double map which seems to work).

VMAP has its own pdp now allowing to map 512GB of
physical address space. this simplifies the code
a bit and gives nice virtual addresses.
2014-02-15 06:17:05 +01:00
Matthew Veety 1d64be1984 added in a way to make net.rc wait for the network hardware to come up before running ip/ipconfig. This fixes the issue with the Raspberry Pi where ip/ipconfig tried running prior to /net/etherU3 exists 2014-02-14 22:05:25 -05:00
cinap_lenrek de4aec9fbd libc: remove malloc.acid and pool.acid 2014-02-14 15:20:34 +01:00
cinap_lenrek 14770ad188 page: fix compiler warning 2014-02-14 15:01:14 +01: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 fc78640118 nusb/ether: fix pointer truncation 2014-02-14 14:18:09 +01:00
cinap_lenrek dd4a487b0e webfs: fix compiler warning 2014-02-14 14:14:17 +01:00
cinap_lenrek 80deec0a7b ip/torrent: remove unneeded assignment 2014-02-14 14:12:02 +01:00
cinap_lenrek 38c35d6195 acid: add semacquire/semrelease/tsemacquire syscalls, handle _seek hack for amd64 (thanks erik) 2014-02-14 14:02:33 +01:00
Matthew Veety 3f9d92c1a8 similar to my last commit, but combined the two waits for the usb devices. still configurable, but with usbwait. If usbwait is not defined then it defaults to the original 2 seconds. 2014-02-14 00:11:11 -05:00
mischief 7d73312def pc64: add ahci.h to PCHEADERS so it will be removed on mk clean 2014-02-12 03:02:23 -08:00
mischief 6edd7255c7 pc64: remove ethermii.h and copy it from pc instead 2014-02-12 03:00:12 -08:00
Matthew Veety 6a12aef885 added pccpu64 for cpuservers. also enabled etherigbe in pc64 and pccpu64 2014-02-12 21:05:04 -05:00
cinap_lenrek b7b68668cf acid: fix acid/network, fix address formats from X to A 2014-02-12 20:04:07 +01:00
cinap_lenrek cd17077749 truss: support for amd64 2014-02-12 19:27:08 +01:00
cinap_lenrek ad38f0eb1c pool(2): fix ulong -> uintptr 2014-02-12 18:53:03 +01:00
cinap_lenrek 872f83cebe ramfs: remove mainmem pool limit when called with -u flag 2014-02-10 04:04:51 +01:00
cinap_lenrek 7f73792ef9 pc64: limit memory of per processor mmu freelist to 1MB 2014-02-10 02:37:45 +01:00
cinap_lenrek e37ff43eb6 acid: remove objchar, prefering foobar.$objtype.acid
acid already sets up objtype for us.
2014-02-10 01:53:26 +01:00
cinap_lenrek c4679d743a pc64: return up in RUSER (BP) for devproc kregs file 2014-02-10 23:12:52 +01:00
cinap_lenrek 37de63aec3 cc: emit right acid format for address
we could use 'A' here but then it would require the new acid.
2014-02-10 23:10:47 +01:00
cinap_lenrek de356dd855 acid: update acid libraries for amd64 2014-02-10 23:07:37 +01:00
cinap_lenrek 16acf605e2 acid: make 'a' and 'A' format to have the same size as mach->szaddr
to make it easier to write portable acid code, we
introduce 'A' format in the same meaning as in db(1):

A    Print the value of dot in hexadecimal.  Dot is
     unaffected.

both 'a' (symbolic) and 'A' will both have 64 or 32 bit
size depending on the mach, so pointer array indexing
works the same.
2014-02-09 22:43:09 +01:00
cinap_lenrek 9bdf602ebb pc64: pass Ureg* argument in BP to userspace note handler 2014-02-09 02:23:33 +01:00
cinap_lenrek 9d8f5a1466 acid: fix memory corruption due to gc
we cannot call gc() in execute() because it will gc
anonyous intermediate results which happens when we
construct a list and the elements are calculated by
calling a function thru ocall() which calls execute().

also, the _thiscmd symbol; which is used to keep
a reference to a statement so it wont get garbage
collected; does not work as yyparse() is recursive
(include statements).

we add execrec() function which *only* gets called from
yyparse() when evaluating a statement. it will
keep a stack on the _thiscmd symbol handling the yyparse()
recursion.

we also only call gc() in execrec() before calling
execute(). so execute() will never gc() while evaluating
a statement which prevents the intermediate results
from getting collected.
2014-02-09 01:37:05 +01:00
cinap_lenrek 6b146c70c2 pc64: handle negative file offsets when accessing kernel memory with devproc
file offset is 64 bit signed integer, negative offsets
are invalid and rejected by the kernel. to still access
kernel memory on amd64, we unconditionally clear the sign
bit of the 64 bit offset in libmach and devproc sign
extends the offset back to a 64 bit address.
2014-02-08 03:50:41 +01:00
cinap_lenrek 43212f6432 mtrr: fix mistake 2014-02-08 03:40:17 +01:00
cinap_lenrek 7af85b9e74 jpg: center image in screen
when using the jpg(1) programs interactively, draw the
image in the center of it. this avoids wasting space
with always on borders on small windows and looks better
when used in fullscreen.
2014-02-08 02:33:29 +01:00
cinap_lenrek b3df8945bd reuse mtrr slots with default memory type 2014-02-08 01:01:26 +01:00
cinap_lenrek 9c99675c1c aux/vga: fix format string error with 6c 2014-02-08 00:29:06 +01:00
cinap_lenrek eaafcf2187 pc64: bump segment limit to 64GB 2014-02-08 00:23:18 +01:00
cinap_lenrek 2b4706b662 pc64: dont reuse mtrr slots that are above 4GB
we used to override/reuse mtrr slots over 4GB as the
kernel wasnt able to use that memory. pc64 can.
2014-02-07 20:04:19 +01:00
mischief fc7f6f8e99 pc64: ensure user pc is never set to a non-canonical address through setregisters
on intel processors, a general protection exception is fired if a non-canonical address is loaded into PC during SYSRET. this will cause the kernel to panic.

see http://www.kb.cert.org/vuls/id/649219 and the intel software developer manual for more information.
2014-02-06 18:03:17 -08:00
cinap_lenrek 0fdb1578ef pc64: fix devcons format strings for memory sizes 2014-02-07 23:35:27 +01:00
cinap_lenrek 88cc09a580 cwfs: limit memsize() to 1GB until pool can handle huge allocations 2014-02-07 23:33:34 +01:00
cinap_lenrek c3917ec566 pc64: fix poolsummary() string format 2014-02-07 23:02:56 +01:00
cinap_lenrek e836796365 pool: use uintptr for pool size
note, arenas and blocks still use ulong for sizes. so
we have to check for overflow when attempting to merge
arenas.
2014-02-06 22:47:05 +01:00
cinap_lenrek c065eadb53 pc64: fix note handling 2014-02-06 22:43:33 +01:00
cinap_lenrek bfbc5ab197 pc64: fix kmap()
kmapindex has to be per process, not per mach, as the process
can be switched to another processor while the mapping is
established.

to bootstrap the first process, we have to temporarily set up
so the kmap MMU's can be attached to the process. previously
we assumed that the first two pages for the initial process
where below 2GB and could be accessed with KADDR() directly.
with 16GB machine, all the 2GB above KZERO are dedicated to
the kernel so the user pages returned by newpage() need to
be mapped.
2014-02-06 22:41:42 +01:00
cinap_lenrek f029ea1694 have to use NULL instead of nil for ape programs... 2014-02-05 19:52:09 +01:00
cinap_lenrek 868a262bb8 pc64: dont 4 byte align stack pointer for amd64 in sysexec() 2014-02-05 19:48:36 +01:00
cinap_lenrek c76243e7e5 fix wrong type for terminating nil argument for execl()
we have to use (void*)0 instead of (int)0 otherwise the
upper bits are uninitialized on amd64.
2014-02-05 19:25:24 +01:00
mischief 492958f08e libpanel: remove pointless pointer casts 2014-02-04 00:16:36 -08:00
cinap_lenrek 8c4a02a29b merge 2014-02-05 08:58:53 +01:00
cinap_lenrek 9f99edda55 mothra: better handling of malformed search regex 2014-02-05 08:43:31 +01:00
mischief ffcac11a5a libpanel: fix pointer casts and format strings 2014-02-04 23:34:19 -08:00
cinap_lenrek 0b1c655160 mothra: dont panic on invalid regular expression in searchbox 2014-02-05 08:25:01 +01:00
mischief 1eef373152 pc64: fix up pointer calculations and enable sdvirtio disk driver 2014-02-03 01:22:26 -08:00
cinap_lenrek 34f7e4ef9a pc64: remove cinaps cga screen interrupt debugger, was experiment... 2014-02-04 02:08:26 +01:00
cinap_lenrek de0712c0b5 pc64: dont dump user registers on exception, was experiment... 2014-02-04 02:06:11 +01:00
cinap_lenrek b7be695d5c hjfs: fix wrong channel size for syncb (fixes amd64 crash) 2014-02-04 01:58:17 +01:00
cinap_lenrek 3f522c745a doom: port to amd64 2014-02-04 01:09:46 +01:00
cinap_lenrek 88505bff06 realemu: cleanup opidiv
no need for switch here, just calculate the values. also fixes
6l warning about uninitialized min/max (compiler assumes none
of the case statements could match).
2014-02-03 22:55:45 +01:00
cinap_lenrek fefc7b526d libmach: change mach pgsize back from 4K to 2MB for amd64
the Mach page size is used to calculate segment alignment. its
not the real effective page size used by the kernel.

this fixes acid.
2014-02-03 22:39:07 +01:00
cinap_lenrek bfbb68a712 ipmux: fix 6c complaints 2014-02-03 20:14:19 +01:00
cinap_lenrek 94282847ec merge 2014-02-03 20:06:12 +01:00
cinap_lenrek ccfb6168c8 kernel: dont double ptemap size in newseg()
this doubling affects all segment types, not just bss.
(tho text/data are usually small...)

and theres no telling if the segment will actually
grow in the future justifying the reduction of memmove
overhead in ibrk().

some ape programs are approaching the 16mb ssegmap size
so that code might trigger.

removing the smarts...
2014-02-03 20:04:43 +01:00
cinap_lenrek 6a55790197 pc/pc64: move common code to pc/devarch.c 2014-02-03 06:24:31 +01:00
cinap_lenrek c3028fb924 pc64: implement shutdown and idlehands
just copies from pc kernel. should refactor into common
pc code.
2014-02-03 05:29:53 +01:00
mischief 35d19fc6fb merge 2014-02-02 07:41:56 -08:00
mischief d082e3a5ae pc64: enable sdide driver 2014-02-02 07:34:54 -08:00
mischief ddd51650d8 acid: fix memory leak in fundefs (from 9atom) 2014-02-02 03:17:48 -08:00
cinap_lenrek b5d47d6deb libdraw: fix typo: 0xfffff -> 0xffff 2014-02-03 03:56:01 +01:00
cinap_lenrek 5fd52f6241 libdraw: work arround devdraw truncating screenid as 16bit 2014-02-03 03:53:18 +01:00
cinap_lenrek f556fd2437 devdraw: screenid is BGLONG, not BGSHORT 2014-02-03 03:52:27 +01:00
cinap_lenrek bfee76e5d3 pc64: track per process kmap page tables in separate MMU list.
we have to keep kmap page tables in ther own list
because user tables are subject to (virtual) tlb flushing.

we never free kmap page tables except in mmurelease()
where we just link the kmap mmu list in front of the user
mmus and call mmufree() which will free all the mmu's
of the process.
2014-02-02 18:01:13 +01:00
cinap_lenrek b7b3406657 malloctag: only store lower 32bit of malloc tag, fix getrealloctag
as erik quanstro suggests, theres not much of a point in
storing the full 64bit pc as one cannot get a code segment
bigger than 4G and amd64 makes it hard to use a pc that
isnt 64bit sign extension of 32bit.

instead, we only store ulong (as originally), but sign
extend back when returning in getmalloctag() and
getrealloctag().

getrealloctag() used to be broken. its now fixed.
2014-02-02 16:03:59 +01:00
cinap_lenrek 0cdb32cc18 kernel: fix bogus free in sysexec.
we free the wrong pointer in the waserror() block.
2014-02-02 15:11:19 +01:00
cinap_lenrek 269788514c newuser: dont bark when we cannot bind $home/bin/$objtype after /bin, create $home/bin/amd64 2014-02-02 10:59:05 +01:00
cinap_lenrek 29eea45931 kernel: do not pass user address of fd[2] array to newfd2()
access to user memory can pagefault and newfd2() holds
fgrp spinlock while writing to it. make temporary copy
on the stack in syspipe().
2014-02-02 10:41:51 +01:00
cinap_lenrek 0b95485db7 kernel: use uintptr when appropriate in syssegflush() 2014-02-02 09:59:54 +01:00
cinap_lenrek 02fef73b8f pc64: dont dump registers for user process on pagefault error, was experiment 2014-02-02 09:39:58 +01:00
cinap_lenrek 2a4f7a1eb1 pc64: no need to flush tlb in kunmap(), was experiment 2014-02-02 09:22:23 +01:00
cinap_lenrek 4c97cb34ac add acid library for amd64 2014-02-02 08:41:13 +01:00
cinap_lenrek db2e22aebe pc64: fix mmu structure leakage, implement global pool 2014-02-02 08:12:08 +01:00
cinap_lenrek 47f551bcea pc64: print only 8 hex chars dumpstack sp/pc
kernel addresses are sign extended to 64 bit. upper bits
are not really helpfull.
2014-02-02 05:49:30 +01:00
cinap_lenrek a6fd3cc8e3 mallocalign: make sure alignptr offset is modulo align when -offset > align 2014-02-02 05:47:13 +01:00
cinap_lenrek e289fd8ccd pc64: fix vmap
VMAP address calculation was all wrong resulting
in vmaps get mapped into KZERO map.
2014-02-02 05:10:58 +01:00
cinap_lenrek 0850718033 pc64: enable iahci support 2014-02-01 20:27:54 +01:00
cinap_lenrek 03d26f8087 cwfs: use pragma pack for on disk structures for amd64 2014-02-01 20:26:36 +01:00
cinap_lenrek 42f4cdc3fd rootstub: create amd64 directories for acme 2014-02-01 20:19:06 +01:00
mischief 4092bdbb2e realemu: actually mark 0xE0000 writeable 2014-02-01 12:56:59 -08:00
mischief 1fe36bf849 realemu: implement IDIV, mark 0xE0000 writeable, fix DIV overfow trap 2014-02-01 12:27:07 -08:00
mischief 08bb4afb52 acid: use correct print flags and casts for shorts in fmt 2014-02-01 12:14:30 -08: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 ed9e9f98e9 libc and ape support for amd64 2014-02-01 10:31:41 +01:00
cinap_lenrek cc24222672 fixes for new setmalloctag() prototype 2014-02-01 10:29:14 +01:00
cinap_lenrek 8006695405 gs: amd64 support 2014-02-01 10:28:33 +01:00
cinap_lenrek 2dbdfe8ac7 python: amd64 support 2014-02-01 10:27:57 +01:00
cinap_lenrek 56343cafcf add experimental pc64 kernel 2014-02-01 10:25:10 +01:00
cinap_lenrek 28ad4e6616 pc kernel: split mpstartap() and squidboy into separate file... stuff for amd64 2014-02-01 10:23:17 +01:00
cinap_lenrek 06bc19c28f kernel: usb fixes for amd64 2014-02-01 10:20:43 +01:00
cinap_lenrek dcea714680 kernel: fix pointer truncation in xspanalloc(), fix format prints 2014-02-01 10:17:53 +01:00
cinap_lenrek 7613608b23 kernel: handle amd64 40 byte headers in exec() 2014-02-01 10:16:55 +01:00
cinap_lenrek 88476df541 vesa: explicitely use /386/include/ureg.h 2014-02-01 10:14:41 +01:00
cinap_lenrek 090fd6ec0c libmach: pc64 uses 4K pages, IP -> PC 2014-02-01 09:55:34 +01:00
cinap_lenrek 9a52340313 libmemdraw: apply erik quanstros fix for sign preserving in byteaddr() 2014-02-01 09:54:09 +01:00
cinap_lenrek d77455ab2d libdraw: use pid as initial screenid so one can have more than 25 windows. 2014-02-01 09:53:08 +01:00
cinap_lenrek 010af9ba12 6l: fix warning, setmalloctag declaration, missing header type cases 2014-02-01 09:52:06 +01:00
stanley lieber 0efcfcc60c fortunes: undelete 2014-01-22 01:19:50 -05:00
cinap_lenrek ca7c413ff1 sdiahci: fix hardcoded 512 byte sector size 2014-01-22 20:12:19 +01:00
cinap_lenrek 520957e254 kernel: fix ulong abuse in xalloc 2014-01-21 22:12:25 +01:00
cinap_lenrek ebfb4fdf29 kernel: convert putmmu() to uintptr for va and pa 2014-01-20 03:17:55 +01:00
cinap_lenrek ad1eefb355 kernel: various cleanups 2014-01-20 02:16:42 +01:00
cinap_lenrek cb0393181a malloc(2): update alloctag types 2014-01-20 00:54:36 +01:00
cinap_lenrek 6c2e983d32 kernel: apply uintptr for ulong when a pointer is stored
this change is in preparation for amd64. the systab calling
convention was also changed to return uintptr (as segattach
returns a pointer) and the arguments are now passed as
va_list which handles amd64 arguments properly (all arguments
are passed in 64bit quantities on the stack, tho the upper
part will not be initialized when the element is smaller
than 8 bytes).

this is partial. xalloc needs to be converted in the future.
2014-01-20 00:47:55 +01:00
cinap_lenrek b99ecee6cd malloc: change malloc and realloc tag types to uintptr 2014-01-20 00:09:53 +01:00
cinap_lenrek 43ae553195 ape: remove local copy of memccpy() 2014-01-20 00:05:19 +01:00
cinap_lenrek 8a72dc1c6b kernel: fix declaration of getcallerpc() 2014-01-19 03:32:50 +01:00
cinap_lenrek ba787cc587 kernel: replace BY2WD in scanline width calculation to sizeof(ulong) like libmemdraw 2014-01-19 03:29:52 +01:00
cinap_lenrek 02a2eb6676 libmach: fix wrong operand order of MOVLQSX instruction disassembly 2014-01-17 21:09:17 +01:00
aap 7e1b43a53a Corrected some man pages. 2014-01-17 19:15:24 +01:00
cinap_lenrek 79e8f53e89 devdraw: fix memory corruption reading draw ctl file
when user does read of exactly 12*12 bytes on draw
ctl file, the snprint() adds one more \0 byte writing
beyond the user buffer and corrupting memory.

fix this by not snprint()ing the final space and add
it manually.
2014-01-14 00:22:13 +01:00
stanley lieber 0c6a90484c add /lib/uriel; delete fortunes 2014-01-12 13:00:02 -05:00
Matthew Veety aeb49aca9e added a segment for segattach(2) that gives access to the raspberry pi's gpio header. 2014-01-12 11:00:38 -05:00
cinap_lenrek a5525457bd etheryuk: fix lockups (thanks burnzez for testing)
according to a comment in linux driver, reading Isrc2
register caused interrupts to be disabled. we used
to read Isrc2 in ifstat() and it was confirmed that
reading ifstat locks up ethernet. removing the Isrc2
read in ifstats, and also reenable interrupts after
reading Isrc2 when the interrupt was not for us.
(this is from the linux driver)

in replenish(), set ring software write pointer (Sring.wp)
*before* the hardware write index register. otherwise
rx() could get status notification for completed
receive but wont find the rx descriptor in the ring.

handle uint wrap arround when calculating ring fill
count and remaining count.
2014-01-12 12:08:10 +01:00
cinap_lenrek 5d9f0ed326 netif: fix wrong qid in 3rd level stats/ifstats files (thanks burnzez)
the stats and ifstats files in the 3rd level of a netif
are not per connection, but for the interface.

this made fstat fail for /net/ether0/N/*stats where N > 0
as the NETID() bits in the qid didnt compare.
2014-01-11 16:07:35 +01:00
cinap_lenrek 6a83facfb3 rio: properly handle initial wrap arround in wlook() 2014-01-11 10:46:07 +01:00
cinap_lenrek 7c503e6f49 rio: implement "look" (thanks lf94) 2014-01-11 10:14:35 +01:00
cinap_lenrek 784e6ff8cd kernel: fix fairshare formula in comment (thanks erik) 2014-01-10 15:12:28 +01:00
cinap_lenrek fc88896fc1 mixfs: make mixbuffer addition atomic
serialize mixing with spinlock to make the addition
on the mixbuffer samples atomic.
2014-01-10 14:51:29 +01:00
cinap_lenrek f4550c4d6a merge 2014-01-10 01:20:24 +01:00
cinap_lenrek aa8f8d866b libdraw: cleanup string() and stringwidth()
getting rid of the goto at the end of the while
loop by moving the if(subfontnae) case before
the cachechars() call.
2014-01-10 01:19:14 +01:00
mischief a872d5241e winwatch: this is not about sanity. rows might be negative 2014-01-08 21:32:27 -08:00
mischief 8319457a10 winwatch: prevent divide by zero if the window height is too small 2014-01-08 20:52:40 -08:00
cinap_lenrek ce2487c3cc mothra: remove version 2014-01-07 02:57:39 +01:00
cinap_lenrek 720967f984 libframe: fix _frcanfit() for zero width runes, simplify chopframe() 2014-01-07 02:24:16 +01:00
stanley lieber ee4ddd77f7 weather: trim garbage from output 2014-01-06 14:55:42 -05:00
cinap_lenrek cae41c18ff libframe: avoid _frcanfit() call in frdelete()
no need to calculate number of runes to fit in
box when box contains no runes.
2014-01-06 03:56:45 +01:00
cinap_lenrek e3b4950966 libdraw: fix stringwidth problems
cachechars() used to skip over characters on its own when
loadchar() could not find the character or a PJW replacement.
this resulted in wrong width calculation. now we just return
and handle the case inside _string and _stringwidth.

fix subfont leak in stringwidth()

remove annoying prints in stringwidth()
2014-01-06 03:49:14 +01:00
cinap_lenrek b7ab1354e3 merge 2014-01-05 02:39:23 +01:00
cinap_lenrek f912e01854 rio: make scrollwheel handling consistent with sam
scrollwheel now works proportional to y mouse position.
special case is when shift is hold down. then scrollwheel
will work like before and scroll one line up or down.
2014-01-05 02:37:42 +01:00
stanley lieber 473e97869f fortunes: This is Go. 2014-01-04 13:13:38 -05:00
cinap_lenrek 6929f0a986 kernel: simplify procalarm() 2014-01-03 02:16:18 +01:00
cinap_lenrek 8ebe3f680e alarm: skip timed out alarms when inserting in procalarm() (thanks erik)
from erik quanstros 9fans post:

i think the list insertion code needs a single-read
test that f->alarm != 0. to prevent the 0 from
acting like a fencepost.  e.g. trying to insert -10 into
list -40 -30 0 -20.

	if(alarms.head) {
		l = &alarms.head;
		for(f = *l; f; f = f->palarm) {
>>			fw = f->alarm;
>>			if(fw != 0 && (long)(fw - when) >= 0) {
				up->palarm = f;
				*l = up;
				goto done;
			}
			l = &f->palarm;
		}
		*l = up;
	}
2014-01-03 01:40:17 +01:00
cinap_lenrek d1be5e163c ps2mouse: retry disable packet streaming command 0xf5
disabling mouse packet streaming command 0xf5 can fail
when a packet is currently transmitted.

this can be seen when one moves the mouse while running:

while(){echo accelerated >/dev/mousectl; sleep 0.5}
2014-01-02 11:07:06 +01:00
cinap_lenrek e56affb840 ps2mouse: disable packet streaming during reprogramming
sometimes, ps2 mouse setup failed on thinkpads during boot. disabling
packet streaming while we program the mouse seems to fix the issue.
2014-01-02 07:44:17 +01:00
cinap_lenrek 0e242236ba merge 2014-01-01 07:41:06 +01:00
cinap_lenrek 1a02a45883 kernel: nil check, exited procs handling in postnote()
make sure not to dereference Proc* nil pointer. this can potentially
happen from devip which has code like:

	if(er->read4p)
		postnote(er->read4p, 1, "unbind", 0);

the process it is about to kill can zero er->read4p at any time,
so there is the possibility of the condition to be true and then
er->read4p becoming nil.

check if the process has already exited (p->pid == 0) in postnote()
under p->debug qlock.
2014-01-01 07:39:17 +01:00
cinap_lenrek 18a50d04ac proc(3): the args file is writable, not read only (thanks qrstuv) 2014-01-01 06:44:48 +01:00
cinap_lenrek 9a98f28f1e kernel: remove error label in pgrpnote() arround postnote
postnote does not raise error, so the error label is not
neccesary.
2014-01-01 05:16:41 +01:00
cinap_lenrek f481ac716d kernel: fix alarm postnote race
when alarmkproc is commited to send the alarm note to the process,
the process might have exited already, or worse, being reused for
another process. pexit() zeros p->alarm at the beginning, but the
kalarmproc() might read p->alarm before pexit() zeroed it, decide
to send the note, then get preempted and pexit() releases the proc.
once kalarmproc() is resumed, the proc might be already something
different and we send the note to the wrong thing.

we now check p->alarm under the debug qlock. that way, pexit()
cannot make progress while we test the condition.

remove the error label arround postnote(). postnote does not raise
error.
2014-01-01 05:14:38 +01:00
cinap_lenrek 0feb6e06af devproc: fix noteid permission checks for none
make sure noteid is valid (>0).

prohibit changing note group of kernel processes. this is also
checked for in pgrpnote().

prevent "none" user from changing its note group to another "none"
sessions. this would allow him to send notes other none processes
other than its own.
2013-12-31 12:23:55 +01:00
cinap_lenrek 00ff4beaa7 kernel: check for error label stack underflow in nexterror() 2013-12-31 07:29:55 +01:00
stanley lieber 02d22e158d mothra: mouse scrollwheel behave the same as in sam 2013-12-31 00:52:52 -05:00
cinap_lenrek 50bda3d522 kernel: halt idle processors on mp system by default (from sources)
one can add:

int idle_spin = 1;

in the kernel configuration to enable the old behaviour. see the
comment at idlehands().
2013-12-31 04:41:51 +01:00
cinap_lenrek 4c8cfe7284 kernel: remove unused debug cprint() function from port/cache.c
the cache can be inspected more easily with acid kernel library.
2013-12-29 07:50:58 +01:00
cinap_lenrek 42074003ca kernel: dont call pprint() while holding up->debug qlock
pprint() might block or even (maliciously) call into
devproc write which will corrupt the qlock chain on attempt
to qlock up->debug again.
2013-12-29 07:48:19 +01:00
cinap_lenrek afc2d547e1 kernel: make sure user text, data and bss wont overlap the stack segment in sysexec() 2013-12-29 06:11:18 +01:00
cinap_lenrek 8cef1794d6 mothra: add regular expression text search (thanks mischief, sl)
this works differently from mischiefs original patch. instead of
overloading the address bar, we popup our own enter box. the
function can be invoked from the menu or by hitting ^F.
2013-12-28 21:48:53 +01:00
cinap_lenrek 59d8c24f58 page: fix page bookmarks for epub files 2013-12-28 06:49:51 +01:00
cinap_lenrek 7143b286b7 ape: move strdup() from libbsd to libap (from sources)
including <string.h> should be enougth to make strdup()
available.
2013-12-28 05:14:10 +01:00
stanley lieber 4aa68d2f3a cifs(4): replace with correct version 2013-12-27 16:42:36 -05:00
stanley lieber 066ef28390 cifs(4), cifsd(8): add HISTORY 2013-12-27 16:32:37 -05:00
stanley lieber 459f018d0d add HISTORY to various man pages 2013-12-27 16:22:05 -05:00
cinap_lenrek 7d9ae4883d audio/mixfs: implement Tstat to obtain buffer size, better underrun handling 2013-12-27 20:39:56 +01:00
stanley lieber 9c4ca0a51c audio(1): add pcmconv to HISTORY 2013-12-26 16:22:23 -05:00
stanley lieber 5ff9c61b90 fortunes: That's a video card, Blake. 2013-12-26 16:11:05 -05:00
stanley lieber 88f45cef4f audio(3): fix spelling 2013-12-26 16:07:01 -05:00
stanley lieber c45123d623 audio(1): add HISTORY, fix spelling 2013-12-26 16:06:37 -05:00
cinap_lenrek b9bec46b98 add audio/mixfs to allow simultanious playback streams over a single /dev/audio 2013-12-26 21:04:25 +01:00
cinap_lenrek cad92eedd9 json(2): fix out of order SOURCE heading 2013-12-25 20:09:00 +01:00
cinap_lenrek bb4aba830b devmouse: exclude sroll-wheel buttons from differential button handling
preventing wheel buttons 4 and 5 fron getting stuck
with multiple input devices.
2013-12-25 16:52:55 +01:00
cinap_lenrek 3e8764aef1 acid leak: remove arena pointer a < 0xff000000 check
in the kernel, area can lie above 0xff000000
2013-12-25 15:00:39 +01:00
cinap_lenrek 3f9867c4ce devdraw: fix drawdelname() string memory leak 2013-12-25 14:55:16 +01:00
cinap_lenrek 1059da0066 page: scrollwheel, better backwards scrolling, fix blit bug when page was translated offscreen 2013-12-23 15:38:52 +01:00
stanley lieber 9e021d9230 /sys/lib/plumb/basic: add commas to some rules for file names that will frequently contain commas 2013-12-22 14:56:04 -05:00
cinap_lenrek 5fbc2ea9ce merge 2013-12-21 18:06:24 +01:00
cinap_lenrek 5dae7fcc68 add plumbing rules for page bookmarks and audio playback 2013-12-21 18:04:50 +01:00
cinap_lenrek 48d2f14f80 page: implement bookmarks (thanks trav_ for starting it)
add new functions pageaddr() that returns a string describing
the page to be loaded. it is in the form of:

/path/to/file!pagename!subpage!....

one can jump to such a page by calling trywalk(name, addr)
where name and addr get concatinated with ! to form a page
address and then the currently loaded pages are walked up
to the nearest page which is then returned. (or nil when
not found). the remaining address will be set in the global
pagewalk variable.

once pages get loaded (asynchronously), pagewalk1() gets
called again on addpage() and continues the walking up to the
last page.

new program flag -j <addr> was added to jump to a page on
startup.

page address (without filename) can also be supplied in
plumb message with the "addr" attribute.
2013-12-21 18:04:14 +01:00
stanley lieber 190653f049 fortunes: What an amazing year for the Web. 2013-12-19 15:08:28 -05:00
stanley lieber 9b03130bb9 json(2): fix spelling error 2013-12-19 14:59:50 -05:00
cinap_lenrek 803bc88a5f add medium to low quality json(2) manual page 2013-12-19 19:56:04 +01:00
cinap_lenrek 56300f72e8 rio: dont consider shell characters as part of the filename for auto completion
rio looks backwards in the line for the beginning of a filename
that needs to be completed with ^F. this change makes the
characters: =, ^, ( and { stoppers, so filename completion
will work in all these cases:

foobar=/foo/ba^F; for(i in (fo^F ba^F)){/bin/baz^F

this means completion will not work for prefixes having these
special characters in them.

thanks to burnzez for bringing it up.
2013-12-19 18:12:16 +01:00
cinap_lenrek 0866d65f8e acid leak: handle ALIGN_MAGIC padding of skip area for mallocalign()
the alloc and realloc tag words do not start at the beginning of
a block created by mallocalign(). instead, the block is padded
with ALIGN_MAGIC.
2013-12-17 15:40:12 +01:00
cinap_lenrek 65f426c0bd pool: update debug log format string for poolallocalign() 2013-12-17 15:32:48 +01:00
cinap_lenrek 6e2bea734b devether: fix spelling mistype 2013-12-17 12:48:17 +01:00
cinap_lenrek f3f89e03ed ether82598, ether82563: remove packblock() avoidance hack 2013-12-16 21:47:06 +01:00
cinap_lenrek ce5f9d8210 etheryuk: fix problems with yukon2 ep+ rev0, deoptimize 2013-12-16 21:39:22 +01:00
cinap_lenrek ea6fea596b devether: remove qfull prints and fix loopback packet handling of etheroq()
dont spam the console with qfull warnings. this makes things worse.

handle loopback packets as stated in the comment. we call etheriq()
with fromwire=1 for loopback packets so etheriq() can pass the packet
on (without copying) or free it. dont inhibit interrupts while calling
etheriq(). etheriq() can safely be called from process and interrupt
context. it is unclear what this was supposed to fix and testing didnt
seem to have any odd effects.
2013-12-16 19:19:15 +01:00
cinap_lenrek 6946118644 devssl: use parsecmd() to process control message to get rid of 128 byte stack buffer limit
(11:02:29 PM) me: why is buf in /sys/src/9/port/devssl.c:/^sslwrite only 128 bytes?
 (11:02:58 PM) me: it makes it so you can't use a 128 bytes secret as negotiated by infauth in a secretin or secretout ctl message
 (11:03:30 PM) me: which in turn means you can't use such a secret with pushssl(2)
 (11:06:15 PM) me: inferno's sslwrite is limited to 32 bytes, but its ssl library writes to the secret files instead of to the ctl file
 (11:08:50 PM) mischief: what should it be instead of 128 bytes
 (11:08:58 PM) me: larger
 (11:09:16 PM) mischief: how about 129 bytes?
 (11:09:59 PM) me: also broken in 9front, by the way
 (11:15:14 PM) me: i guess it should be replaced with parsecmd
2013-12-16 10:06:34 +01:00
cinap_lenrek 35484945e2 exportfs: get rid of limits, cleanup
get rid of the service buffer limit. keep service buffers
on a global freelist protected by lock.

dont fatal when we hit the process limit. instead, just
abort the rpc with an error.

handle rendezvous() interrupts.
2013-12-15 07:49:53 +01:00
Matthew Veety 7d001bd2b2 god damn it forgot fucking fns.h from my last commit 2013-12-13 02:24:15 -05:00
Matthew Veety 9c52f4d9d4 Added in /dev/cputemp for bcm kernel (Thanks Krystian!) 2013-12-13 02:20:29 -05:00
cinap_lenrek 91e9d7466f cifs(4): fix documentation for -d flag 2013-12-11 06:48:02 +01:00
cinap_lenrek 3c8db40def factotum: add ntlmv2 (mschap2) client auth for cifs 2013-12-11 05:48:48 +01:00
cinap_lenrek 71dbddef16 draw: fix drawing of replicated source image on memlayer with a clip rectangle
when a replicated source image with a clipr with clipr.min > Pt(0, 0),
drawclip() would properly translate the src->clipr on the dstr
but then clamp the source rectangle back on src->r.

while traversing down multiple layers, this would cause the translation to
be applied multiple times to the dst rectangle giving the wrong image result.

this change adds a new drawclipnorepl() function that avoids the clamping
of source and mask rectangles to src->r and mask->r. this is then used in
libmemlayer.

the final memimagedraw() call will call drawclip() which will do the final
claming.

a testcase is provided:

#include <u.h>
#include <libc.h>
#include <draw.h>

Image *blue;
Image *red;

void
main(int, char *argv[])
{
	Image *i;

	if(initdraw(nil, nil, argv[0]) < 0)
		sysfatal("initdraw: %r");
	i = allocimage(display, screen->r, screen->chan, 1, DWhite);

	red = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DRed);
	blue = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPaleblue);
	replclipr(red, 1, Rect(10, 10, 110, 110));
	replclipr(blue, 1, Rect(11, 11, 111, 111));

	/* draw on non-layer, works correctly */
	draw(i, i->r, red, nil, ZP);
	draw(i, i->r, blue, nil, ZP);
	draw(screen, screen->r, i, nil, i->r.min);
	flushimage(display, 1);

	/* draw on (screen) layer is too far to the right */
	draw(screen, screen->r, red, nil, ZP);
	draw(screen, screen->r, blue, nil, ZP);
	flushimage(display, 1);

	for(;;){
		sleep(1000);
	}
}
2013-12-09 03:35:01 +01:00
cinap_lenrek 193e55b88c cifs: fix compiler warning 2013-12-08 08:38:44 +01:00
cinap_lenrek 007520e3fe handle NIL user domain, and Z(4) at end of nt blob for ntlmv2
the nt blob ends with 4 zero bytes, this is not the same as
the EOL av-pair terminator!

this makes ntlmv2 work with windows xp with LmCompatibityLevel = 3
2013-12-08 08:34:31 +01: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 d7f90a9096 kernel: simplify pexit(), avoid making wait record for RFNOWAIT (parentless) procs
replaced the p->pid != 0 check with up->parentpid != 0 so
p->pid == up->parentpid is never true for p->pid == 0.

avoid allocating the wait records when up->parentpid == 0.
2013-12-07 08:25:26 +01:00
cinap_lenrek 7761128093 devproc: make sure /proc/n/wait waits for the right process children
theres a race when we wait for a process children and that
process exits before we sleep().
2013-12-07 07:17:32 +01:00
cinap_lenrek 4fd55abb8e kernel: fix pexit() Waitmsg memory leak.
when a process got forked with RFNOWAIT, its p->parent will still
point to the parent process, but its p->parentpid == 0.

this causes the "parent still alive" check in pexit to get confused
as it only checked p->pid == up->parentpid. this condition is *TRUE*
in the case of RFNOWAIT when the parent process is actually dead
(p->pid == 0) so we attached the wait structure to the dead parent
leaking the memory.
2013-12-07 05:38:31 +01:00
cinap_lenrek e2da074d28 gif: remove warning when animated gif is rendered to bitmap 2013-12-07 00:53:01 +01:00
cinap_lenrek 66cc2fa960 mothra: remove debug code, dont create $home/lib/mothra/mothra.err file 2013-12-07 00:51:19 +01:00
stanley lieber a989f89f3e etheriwl.c: add did 4232 for intel wifi link 5100 (thanks, hmr) 2013-12-06 09:43:52 -05:00
cinap_lenrek 6e1c833585 libthread: avoid calling thread waiting for fork/execed process to finish if we dont have to
we do not need to wait for fork/execed program to finish when
not collecting waitmsg. this reduces the number of rio
processes hanging arround for each window shell just waiting
for it to terminate and then dumping the waitmsg.
2013-12-06 05:03:35 +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 5c000bbe63 cpu: add -n flag for the remote site to allow "none" authentification method (inspired from sources cpu-noauth patch) 2013-12-05 22:39:43 +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 ad3ba8838d ndb/dns: check bad name length in convM2DNS.c:^gname() 2013-11-28 23:47:49 +01:00
cinap_lenrek b77eda8fc7 u9fs: fix misuse of Fcall.afid in p9any authentication module. (from sources patch/u9fs-afid)
U9fs(4) misuses Fcall.afid in its p9any authentication module.

The afid field of Fcall structure is only valid with Tauth or Tattach.
Tread, Twrite, Tclunk should use rx->fid instead.  It's been lucky so
far to get the job done because rx->afid survives from previous
Tauth/Tattach.  The issue pops up when several authentications happen
concurrently.

Test case:
	u9fs = 'host with u9fs on tcp!*!564'
	9fs $u9fs; for(i in 1 2 3 4 5 6 7 8){ 9fs $u9fs & }; wait
Should:
	no errors
Should not:
	mount failed: authentication failed
2013-11-28 23:06:03 +01:00
cinap_lenrek da6a10c417 ndb/dns: do dnresolve() loopcheck only on hosts that we havnt already tried
we might get a unreachable nameserver ip from a parent
nameserver. if the remaining set of nameservers does not
loop, we should try to resolve them.

so skip the loopcheck for nameservers already tried.
2013-11-26 22:31:23 +01:00
cinap_lenrek 707698ce10 abaco: make validurl() accept internationalized domain names
validurl() is just used to check if the string is a full
absolute url with a protocol scheme. we do not have to
match the host part *exactly*, only if there is *something*
in the hostpart.
2013-11-25 23:04:06 +01:00
cinap_lenrek 1561f0c4ea webfs: preserve unicode hostname, only convert to ascii when sending over the wire
we'd like to keep Url.host in unicode for factotum key
lookup. only when we send the url in a request, we have
to convert it to ascii.
2013-11-24 21:28:48 +01:00
cinap_lenrek f2bd1de5bd webfs: support for internationalized domain name urls 2013-11-24 11:56:33 +01:00
cinap_lenrek 3720b5ab9c ndb/dns: add support for internationalized domain names 2013-11-24 11:55:26 +01:00
cinap_lenrek 94fd92cb69 kbdfs: fix ctlr+alt+del with new escape pages 2013-11-24 09:07:28 +01:00
cinap_lenrek c2319f37b4 ndb/dns: ignore refused (5) error replies 2013-11-23 04:46:14 +01:00
cinap_lenrek 2f9ae0f8ac removing (outdated) drawterm
drawterm is much better maintained by russ cox,
so removing this outdated copy.

for a more recent version, go to:

http://swtch.com/drawterm/
2013-11-23 01:05:33 +01:00
cinap_lenrek ea5797c073 kbdfs: add esc1+shift and esc1+ctrl pages (see sources kbmap-uk-weird patch)
Add pages for esc1+shift and esc1+ctrl - some UK USB keyboards (Dell) and it seems some
German ones: https://groups.google.com/forum/#!topic/comp.os.plan9/ycok6NTCWCg seem to
generate an esc1 + code scancode combination for the pipe/backslash key. Seems like
overkill to add two whole pages for just two keys, but there again RAM is cheap these days.

Probably should take the changes across to omap/kbd.c (and by extension bcm/kbd.c)
but the changes are trivial.
2013-11-23 00:50:15 +01:00
cinap_lenrek 98f47d5867 kernel: more kproc pexit() and sleep error handling 2013-11-22 22:56:34 +01:00
cinap_lenrek 55d31f2cab pc kernel: kproc error and exit
catch the error() that can be thrown by sleep() and tsleep()
in kprocs.

add missing pexit() calls.

always set the freemem argument to pexit() from kproc otherwise
the process gets added to the broken list.
2013-11-22 22:29:31 +01:00
cinap_lenrek df6b68092c kernel: kproc error and exit
catch the error() that can be thrown by sleep() and tsleep()
in kprocs.

add missing pexit() calls.

always set the freemem argument to pexit() from kproc otherwise
the process gets added to the broken list.
2013-11-22 22:28:20 +01:00
cinap_lenrek 91c7e0b127 acme: fix arrow key oddity (thanks mark van atten and erik)
from 9atom/acmearrowfun patch:

	reported by mark van atten

		In Plan 9 acme, if you type

		{}

		then go back and type text between the brackets

		{Curiouser and curiouser!}

		the right arrow is blocked when you want to go over the closing
		bracket to continue typing to its right. (If you first go to the left,
		and then back to the right, it works.)

		Same for the other brackets: [ ], ( ), < >.

	noted that brackets are not necessary.  same behavior with any
	character.

	fix is to textcommit before moving.
2013-11-22 19:19:37 +01:00
stanley lieber 66fea232bc rio -b: make lighttitlecol darker 2013-11-20 18:40:51 -05:00
stanley lieber 51137ada1a fortunes: That's the process. 2013-11-20 18:38:49 -05:00
cinap_lenrek 2cc152f9e1 ndb/dns: filter dns answers avoiding cache poisoning
only cache what we asked for or need to resolve the
query. filter out everything else.
2013-11-20 22:35:52 +01:00
cinap_lenrek 9155b30f6d ndb/dns: another attempt...
we have to fail the whole query that got no cached
nameservers and nameservers are looping, not just omit
the looping nameserver. issuequery() will refresh
nameserver info for the domain when recursing up.
2013-11-17 06:55:39 +01:00
cinap_lenrek c45386588b ndb/dns: detect query loops
never try to resolve a nameserver address when that nameserver
is in the set of nameservers already being queried.

this situation can happen when the Ta and Taaaa RR's expire, but
the Tns records are still in the cache so there is no usable
nameserver but they still refer to each another.
2013-11-16 04:42:09 +01:00
cinap_lenrek 5f87d8dcc8 ndb/dns: various changes
stop absolute/relative dual use of RR.ttl. now RR.ttl is
*always* the *relative* ttl value. we derive absolute
timeout in RR.expire.

remove unused lookuptime field in DN. replace refs and
keep with mark field in DN. we do not care about the
number of references. only *iff* it is referenced, so
use a single bit for that (bit 0). for keep, we use
bit 1.

remove dolock parameter in dnagenever(), it is not
needed. we always need to lock.

mark local dns servers and domains as never to be aged.

the keeper bit is *just* a cache optimization, preventing
the domain and the domains it points to from being flushed.
it should not be used as a write protect bit in rrattach()
for preventing spoofing as it will prevent updates of say,
cname domains.

remove "removing spam ..." message. these are usualy just
hints, so normal. still, remove the hint as we currently
do no check if the nameserver has authority over the
cname domain.

remove "mydnsquery: trying to send to myself (%s); bzzzt"
message. this can happen when myaddr() fails for other
reasons. myaddr() will print error for us anyway.
2013-11-15 02:00:47 +01:00
cinap_lenrek 2ce68c5aa1 ndb/dns: case sensitive ndb attributes, Domlen consistency, dblookup() inplace lower case conversion, cleanups
ndb keys are strictly case sensitive, so consitently
use strcmp() when comparing attribute keys.

dblookup() used to lower case convert its name argument
inplace to match domain/sys name in ndb. better to do
the convesion in its own buffer and only read from the
name argument.

always use cistrcmp() when comparing DN.name.

the Domlen constant denotes the size of the buffer including
the null terminator. consistently use it as such.

have to hold dnlock in freearea() before reading list
head pointer.
2013-11-13 18:44:45 +01:00
cinap_lenrek cfc705b866 kernel: handle memimageinit() error 2013-11-12 21:43:38 +01:00