summaryrefslogtreecommitdiff
path: root/sbin/slaacd/engine.c
AgeCommit message (Collapse)Author
5 daysConvert sbin and usr.bin to check for imsgbuf_init failure and addClaudio Jeker
imsgbuf_allow_fdpass where needed. OK tb@
5 daysConvert the common imsgbuf_read calls to the post EAGAIN world.Claudio Jeker
OK tb@
5 daysUse imsgbuf_clear() where appropriate instead of msgbuf_clear().Claudio Jeker
OK tb@
5 daysRename imsg_init, imsg_clear, imsg_read, imsg_write and imsg_flush toClaudio Jeker
imsgbuf_init, imsgbuf_clear, imsgbuf_read, imsgbuf_write and imsgbuf_flush. This separates the imsgbuf API from the per-imsg API. OK tb@
5 daysConvert imsg_write() callers to the new simplified return logic.Claudio Jeker
OK tb@
5 daysIntroduce imsg_write() and use it instead of msgbuf_write().Claudio Jeker
imsg_write() is just a thin wrapper around msgbuf_write(). So this is mostly search and replace. OK tb@
2024-08-24Simplify engine_showinfo_ctl()Florian Obser
It only handles one imsg type these days, so it doesn't need to peek into struct imsg at all. pointed out by & OK tb
2024-08-24Do not peek inside of struct imsg.Florian Obser
While here use i2s helper function for error logging. OK tb
2024-07-13Reduce if_indextoname(3) usage.Florian Obser
Don't ask the kernel to translate an if_index to a name if we are not running with verbose logging, it's not free.
2024-06-03more sleepy florian knf issuesTheo de Raadt
2024-04-21Pass advertising router to the kernel.Florian Obser
We are using the ifra_dstaddr for this because it will always be unused with autoconf addresses since they can't be used on P2P links. OK bluhm
2024-02-11Remove needless includes of netinet6/ip6_var.h header in userland.Alexander Bluhm
OK millert@
2024-02-03Stop spamming syslog when the network does something silly.Florian Obser
From Stefan R. Filipek, thanks!
2023-12-14Use imsg_get_fd() to access the fd passed with the imsg.Claudio Jeker
Go ahead florian@ OK tb@
2023-04-30Remove artifical limit of 2 hours on a PIO lifetime, as recommended byPeter Hessler
draft-ietf-6man-slaac-renum-05 and implemented by Linux in 2020. OK florian@
2022-08-26Move (unused) functions under !SMALLKlemens Nanni
if_state_name() and proposal_state_name() are only uesd in log_debug() calls which are NOOPs in SMALL builds. Seen with -Wunused-function warnings in distrib/special/slaacd. OK deraadt
2022-07-23Delete autoconf or temporary address if flag is removed.Florian Obser
OK kn
2022-07-23Delete addresses when interface is no longer autoconf.Florian Obser
This brings it in line with dhcpleased(8) as well as what we do for the default route and DNS proposals. I missed this when I rewrote the state machine to match dhcpleased(8).
2022-07-12Rewrite state machine in the style of dhcpleased(8).Florian Obser
It is less cluttered, easier to reason about and fixes some bugs in passing that would have been difficult in the old state machine. Stale IPv6 addresses, default routes and nameservers are now correctly removed when moving from one IPv6 enabled network to another IPv6 enabled network. Default routes and nameservers correctly expire when they are not refreshed and nameservers are updated when router advertisements change the nameserver option. Testing & input caspar@ Putting it in now to get wider testing and shake out bugs, discussed with deraadt@ at r2k22.
2022-06-28unbreak build; found the hard way by stspFlorian Obser
2022-06-28gc timeout_count, it's unused and I don't remember what I wanted toFlorian Obser
use it for.
2022-06-26remove outdated commentFlorian Obser
2022-03-21Prevent crash of unprivileged engine process (pledged stdio).Florian Obser
The length field of a DNS label in the DNS search list option is an 8 bit unsigned value. parse_dnssl() treats the search list option as an array of char, which are signed on most archs. When we read this value into an int variable it gets sign extended, allowing it to bypass sanity checks and eventually we pass it as the length to memcpy which treats it as a huge unsigned value leading to a heap overflow. An easy fix would be change the signature of parse_dnssl to parse_dnssl(uint8_t* data, int datalen). However, the DNS search list option is unused and the function fails to check if the parsed value is a valid domain name. The function is also getting in the way of future work so it's best to just delete it. The problem was found and reported by qualys, thanks! OK bluhm
2022-02-20Nameservers in router advertisements are struct in6_addr, notFlorian Obser
struct sockaddr_in6. Copy the right amount of data so that we don't overflow the destination and potentially crash when we receive more than 7 nameservers. This is going to be 7.0 errata 014. OK deraadt
2022-01-03Prefix life time is independent from router life time.Florian Obser
Form an IPv6 address even if the router announcing the prefix isn't a default router. Problem reported by mgraves AT brainfat.net on misc OK denis
2021-07-22Send rDNS proposals on ramdiskskn
Otherwise resolvd(8) will never learn nameservers and update /etc/resolv.conf with IPv6 resolvers. At the moment IPv6 only installations always prompt for nameservers anyway, but that is its own bug and will be fixed soon. This enables the upcoming fix to detect learned nameservers in the first place. Feedback OK florian
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2021-05-01Allow running in single user mode where /var/empty doesn't exist byFlorian Obser
switching from chroot("/var/empty") to unveil("/", ""). This is just an extra pair of suspenders since these processes pledge(2) to not access the filesystem. OK deraadt
2021-03-21Use new terminology of RFC 8981 and (mechanically) replace "privacy"Florian Obser
with "temporary".
2021-03-21Don't warn that we can't form a temporary address when a routerFlorian Obser
deprecates a prefix by sending a pltime of 0, this is normal. Continue warning when the pltime is smaller than 5 as this is almost certainly a configuration error. Found the hard way by & OK otto.
2021-03-20RFC 8981 allows the configuration of only temporary IPv6 addresses.Florian Obser
Track autoconf and temporary flag individually to be able to support this. OK kn
2021-03-20Fix SMALL build when done from sbin/slaacdkn
distrib/special/slaccd is the actual SMALL user but having it build from here is useful, too; in fact, it showed some more unused variables under SMALL. OK florian
2021-03-07Withdraw nameservers when the interface goes down.Florian Obser
Problem reported by deraadt some time ago.
2021-03-07Fold get_lladdr into update_iface, now the only caller.Florian Obser
This allows us to pass the link state over to engine here instead of in update_addr which is not available in small. This gets us more in line dhcpleased.
2021-03-07No need to pass the link local and hw address around, we have itFlorian Obser
already in the interface on the engine side.
2021-03-07reshuffle to bring more in line with dhcpleasedFlorian Obser
2021-03-07Introduce engine_update_if().Florian Obser
This was too much code in the imsg handler.
2021-03-06Implement last remaining bits to update from RFC 4941 to RFC 8981.Florian Obser
The desync factor is now tracked per temporary IP and the max value has been increased to about 9 hours. While here fix a bug where the minimum acceptable pltime in a router advertisement should be bigger than PRIV_REGEN_ADVANCE not the desync factor (which didn't make any sense at all). From Fernando Gont, thanks! OK sthen
2021-03-02Fix indentation of switch / case. No binary change.Florian Obser
2021-02-26remove some unused functions in slaacdJonathan Gray
ok florian@
2021-01-19Make imsg event structs static to fix -fno-common.Florian Obser
Follows claudio's lead in ospfd et al. Problem reported by mortimer.
2021-01-19No need for a global slaacd_process; unbreaks -fno-common.Florian Obser
Problem reported by mortimer
2020-10-30Track creation time of address proposals to be able to establish totalFlorian Obser
lifetime. Use this information to renew pltime / vltime of privacy addresses for up to 1 day / 2 days as RFC 4941. This is important when announced pltime / vltime is lower than 1 day / 2 days, privacy addresses would have expired too fast. Spotted after a remark by Fernando Gont on misc@
2020-10-30If Duplicate Address Detection (DAD) fails only generate a new addressFlorian Obser
if we are using Semantically Opaque Interface Identifiers (soii) otherwise we would just create the same address again and DAD will fail again.
2020-10-30Follow RFC 4941 and calculate the desync_factor at startup.Florian Obser
There is probably nothing wrong with calculating a new random value everytime we create an address, but we are also not gaining anything. Makes math in upcomming diffs easier.
2020-10-30Since the RFC 4941 constants are no longer in a public headerFlorian Obser
(netinet6/nd6.h) we can remove the ND6 prefix. While here use a MAX_DESYNC_FACTOR of 10 minutes as the RFC specifies. We are using arc4random_uniform which avoids modulo bias.
2020-10-30Pull check for duplicate address up to skip them early, we are notFlorian Obser
going to renew them. Avoids redundant check for privacy addresses.
2020-10-30update_iface_ra does too much, move prefix handling into function.Florian Obser
2020-10-30update_iface_ra does too much, move dfr handling into function.Florian Obser
2020-10-30update_iface_ra does too much, move rdns handling into function.Florian Obser