Remove external ndb/dnstcp (tcp53) service and serve
tcp clients directly fron ndb/dns process,
taking advantage from the cache.
This avoids slow startup delay for tcp as dnstcp
would need to parse the full network database for
each request. Also, for unknown reasons, dnstcp
would "refresh" the main server on exit, causling
ander database reload for no reason.
Remove cruft:
- straddeling server configuration (-o flag)
I dont think anyone has used this in 9front and
the logic is hard to maintain and test.
- UDP forwarding (-T flag)
Just use snoopy. Or use ipmux and aux/trampoline.
- zonerefreshprogram (-z flag)
This interface sucks. Anyone on the internet can
trigger a refresh and there is no way to authenitcate
the sender.
- undocumented "dump" and "stats" messages.
This should instead be exposed in the file-system
interface. For now, one can access the stats with
acid(1).
Fix bugs:
Handling of unknown RR types was wrong. convM2RR()
would skip ahead in the message when hitting a
unknown RR type, but this gets out of sync with
rrloop()'s rr counter causing spurious parse errors.
Instead, add a Block into the RR type RR.unknown,
where we can stuff the RR data of unknown requests
when the rr is not supported: rrsupported() == 0.
These "unknown" RR types can be printed, but are
discarded in rrattach() as the cache should never
contain unknown RR's.
Fix ip/snoopy -f 'tcp(dns)', need to skip the 2 byte
length field as dns code assumes UDP format.
The refactor:
Big sweep over dnresolve.c, keeping stuff local
on the stack (such as the reply message, fd's)
while putting common stuff in the Query (such as
the recursion depth).
Make logging consistent. Dont have ndb/dnsdebug
enable debuguing, spewing crap on the console.
This kernel is designed for running on the QEMU "virt"
machine. It implements the QEMU ECAM-based PCIe and
utilizes VirtIO drivers for networking and storage.
USB, screen and so on are umimplemented, because this
kernel is meant to be installed via UART, and then
administered as a CPU server via rcpu. It is booted
using U-Boot, so the QEMU "virt" machine "firmware"
is required, otherwise installation is straightforward.
This is the QEMU command used to run this kernel on
an M1 Mac under Hypervisor.framework:
qemu-system-aarch64 -M virt-2.12,accel=hvf,gic-version=3 \
-cpu host -m 4G -smp 4 \
-bios u-boot.bin \
-drive file=9front.arm64.qcow2,if=none,id=disk \
-device virtio-blk-pci-non-transitional,drive=disk \
-serial stdio
This code is based off of the i.MX 8 kernel.
Get rid of the blocking in getactivity()/putactivity(),
and instead split garbage collection over 2 phases (mark bit)
so that dnageall() runs the mark phase only for the current mark
bit and sweep for the previous mark (which then becomes
the current mark after the collection). Note that dnageall()
only runs once the previous phase (previous mark) has no
more active procs.
Also, fix the ageing period controller and make it
more agressive once dnvars.names is twice the target
so we can actually sustain being hammered with new
domain name queries.
the cache is too big; it doesn't measurably improve
performance for most uses, and will run out of memory
on smaller machines. 128 megs ought to be enough for
everybody.
This is just to prevent breaking builds in case
someone compiles 7l with a old 7c compiler that
has the constant propagation bug.
The solution is to move the 64-bit assignments
together at the front.
When writing "refresh" control message to trigger
garbage collection and there are other (query) processes active,
the 9p loop would block until these processes complete.
Instead, defer the garbage collection operation to these
outstanding processes once any of them completes,
keeping the 9p loop un-contended for longer.
When theres no other processes, we can garbage collect
ourselfs immediately (just as before).
Only acquire the dnvars lock on Twrite, so we can handle
other 9p requests while garbage collection is going on.
Also reduce the 60 second timeout to 15 second for queries.
Other dns servers usually use something between 10 and 30
seconds.
Avoid excessive nsec() and time() calls by having timems()
function that only uses nsec() and then updates global
nowms (millisecons) and now (seconds) variable.
After the end of readnet(), timems() needs to be called
anyway to update the query statistics so we can use that
as the new "now".
A file that was not checked in, added, and
then removed would be shown as modified, and
not skipped. It would also be stuck in the
index forever.
This change skips showing untracked moved files
and purges them from the index.
Files will inherit permissions from the parent directory, which
means that a file will show different permissons depending on
where they get checked out. Showing that the file has been
modified this case is technically correct but confusing.
Since git only stores the exec bit, we should only check the
owner exec bit when checking files in and out of git.
git/add .git/foo would happily add files in the
.git directory, leaving it to other tools to filter
them out; we shouldn't do that.
While we're in here, speed things up by not iterating
over long lists of files, and allow removing files
that have not yet been committed.
When a domain name gets long enough, we can end
up passing a remaining length of 0 to seprint.
When seprint has no buffer space at all, it returns
nil, which then crashes our DNS server.
This checks for a nil return from seprint and returns
an error
reorganise device binds for bootrc, cpurc and termrc.
make parallel port, audio, i2c and pci available in
cpurc/termrc console namespace.
remove redundant binds (which are handled by other
scripts).
detailed list:
¤ ¶:
cap and swap need to be bound only in bootrc.
for cpurc/termrc, it is bound from /lib/namespace.
P:
devarch, always good to have.
S f æ:
sd, floppy, aoe are always good to have in the console
namespace. regardless if its a cpu or terminal.
also bound in bootrc for obvious reasons.
note that #k is bound by diskparts script.
t:
uart; we always need it.
b m:
keyboard and mouse only needed in bootrc
for kbdfs and nusb/kb hid devices.
for cpurc/termrc, keyboard is provided by /srv/cons,
and mouse is bound by screenrc.
u:
usb stack, never needs to be bound manually as this
is handled by nusbrc.
v i:
vga and devdraw not needed to be bound here,
handled by screenrc.
L A J $:
parallel port, audio, i2c and pci are good to have in
cpurc/termrc console namespace for trouble shooting
and custom per site / machine rc scripts.
Adding a bitbang i2cgpio driver to overcome the
limitations and brokenness of the i2cbcm driver
and broadcom hardware.
Move the i2cbcm driver from bcm64/ to bcm/ and
comment it out in all kernel configurations
using i2cgpio instead.
The canonical server for fetching draft RFCs is defunct for ftp
access, so a mirror site is now used. Add -d flag to fetch draft RFCs
but otherwise do not. When fetching drafts, also fetch index and
abstract files. For both normal and draft RFCs, only look for .txt
files as there a lot of other files in remote directories that are not
relevant.
Currently we use a 32-bit value for these values which means
that large values passed to -T will be truncated and sign-extended,
rather than stored verbatim. This means load addresses in between
low 2GB and high 2GB will not be respected.
It appears this has been fixed in 6l already, so we can leave it alone.
the issue is that MOVW $imm, R does not sign extend to 64-bit,
leaving the upper 32 bit of the register as zeros.
this means we have to be carefull when propagating negative
constants across loads.
add a "as" argument for the move instruction type,
we can always substitute if we have the same move operation,
then, we test for special cases where it doesnt matter.
to reproduce the issue:
void
main(void)
{
long foobar = -1;
vlong x = -1;
print("%d\n", x == -1);
}
with the change:
/fd/5:2,9 - /fd/4:2,10
RETURN
TEXT main+0(SB),0,$32
MOVW $-1,R1
+ MOV $-1,R3
MOV $.string<>+0(SB),R0
- CMN $1,R1
+ CMN $1,R3
BNE 3(PC)
MOVW $1,R5
B 2(PC)
When attach happens on a port within Attachdelay (3 seconds),
we count it as a repeated attach and if this happens
Attachcount (5) times in a row, we print an error and
refuse to attach the device.
Ori needs this as he has a usb hid device rgb led controller
in his computer that just gives read errors and causes
a continuous reset loop on the port, spamming the console.
nusbrc used to wait forever until initial device
enumeration was completed. the reason is mainly
so that usb stoage or ethernet devices can be
used as boot media.
but this can result in a system getting completely stuck
on boot if usb enumeration gets stuck. (this really
depends on the device driver if some timeouts
have been implemented during attach).
as a compromise, we will wait for usb enumeration
to complete using exponential back-off with a maximum
total wait time of ~10 seconds.
typical times for single device initial enumeration is
0.4 to 0.6 seconds.
largest case i measured with 20 random devices was
7 seconds.
so we will probably be safe with the 10 second timeout.
pridx() can be extremely slow when reading from
imap, because it ensures each message is cached.
Ensuring each message is cached may take a round
trip to the IMAP server.
Instead, we should write the index to a temp file,
and rename it, to reduce the window wher the index
can be broken.