Commit Graph

7 Commits

Author SHA1 Message Date
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Sergey Bugaev
bb06e720de LookupServer: Implement basic mDNS support :^)
The implementation is extremely basic, and is far from fully conforming
to the spec. Among other things, it does not really work in case there
are multiple network adapters.

Nevertheless, it works quite well for the simple case! You can now do
this on your host machine:

$ ping courage.local

and same on your Serenity box:

$ ping host-machine-name.local
2021-05-05 21:16:17 +02:00
Sergey Bugaev
373d135e74 LookupServer: Implement a DNS server :^)
LookupServer can now itself server as a DNS server! To service DNS clients, it
uses the exact same lookup logic as it does for LibIPC clients. Namely, it will
synthesize records for data from /etc/hosts on its own (you can use this to
configure host names for your domain!), and forward other questions to
configured upstream DNS servers. On top of that, it implements its own caching,
so once a DNS resource record has been obtained from an upstream server,
LookupServer will cache it locally for faster future lookups.

The DNS server part of LookupServer is disabled by default, because it requires
you to run it as root (for it to bind to the port 53) and on boot, and we don't
want either by default. If you want to try it, modify SystemServer.ini like so:

[LookupServer]
Socket=/tmp/portal/lookup
SocketPermissions=666
Priority=low
KeepAlive=1
User=root
BootModes=text,graphical

and enable server mode in LookupServer.ini like so:

[DNS]
Nameservers=...
EnableServer=1

If in the future we implement socket takeover for IP sockets, these limitations
may be lifted.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
ae1e82fd2f LookupServer: Introduce DNSName
This is a wrapper around a string representing a domain name (such as
"example.com"). It never has a trailing dot.

For now, this class doesn't do much except wrap the raw string. Subsequent
commits will add or move more functionality to it.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
1dad63824b LookupServer: Unify DNSRequest & DNSResponse
They're really the same thing: a DNS packet can contain both questions and
answers, and there's a single bit in the header that determines whether the
packet represents a query or a response. It'll be simpler for us to represent
both types of packets using the same class.

This class can be both serialized and deserialized to/from a raw DNS packet.
2021-02-06 17:52:47 +01:00
Sergey Bugaev
547130584c LookupServer: Switch to LibIPC :^)
The ad-hoc IPC we were doing with LookupServer was kinda gross. With this,
LookupServer is a regular IPC server. In the future, we want to add more APIs
for LookupServer to talk to its clients (such as DHCPClient telling LookupServer
about the DNS server discovered via DHCP, and DNS-SD client browsing for
services), which calls for a more expressive IPC format; this is what LibIPC is
perfect for.

While the LookupServer side is using the regular LibIPC mechanics and patterns,
the LibC side has to hand-roll LibIPC format serialization without actually
using LibIPC. We might be able to get rid of this in the future, but for now it
has to be like that. The good news is the format is not that bad at all.
2021-02-06 16:12:18 +01:00
Andreas Kling
c7ac7e6eaf Services: Move to Userland/Services/ 2021-01-12 12:23:01 +01:00