summaryrefslogtreecommitdiffstats
path: root/src/if.h
Commit message (Collapse)AuthorAge
* A belated welcome to 2021Roy Marples2021-01-31
|
* dhcpcd: Don't roam when anonymous is setRoy Marples2020-12-27
| | | | We can now remove the NOCARRIER_PRESERVE_IP define.
* Linux: Support wireless IP roamingRoy Marples2020-12-12
| | | | | | | | | | | | | | This is achieved by checking that the interface is wireless, IFF_UP and IFF_LOWER_UP are present, but IFF_RUNNING is missing. This gives exactly the same support as modern NetBSD when carrier loss is detected, but without the address verifications when the carrier comes back as that needs to be handled in the kernel. While IP setup is maintained, other configuration data is discarded. Note that this should be improved in the future. Thanks to Boris Krasnovskiy <borkra@gmail.com> for helping with this.
* dhcpcd: Simplify the link handling even moreRoy Marples2020-10-07
| | | | | | | Move the IS_LINK_UP macro to if_is_link_up function to reduce binary size. Rather than DHCPCD_LINK option controlling the carrier state, use it in if_is_link_up to determine the outcome.
* BSD: struct if_data->ifi_link_state is the single source of truthRoy Marples2020-09-28
| | | | | | | | | | | | | | | | | | | | | | | | Vastly improve and simplify link detection on BSD. dhcpcd either examines the whole system via getifaddrs(3) or reacts to events via route(4). In both cases we have struct if_data which has ifi_link_state. Armed with this knowledge, we no longer need SIOCGIFDATA or SIOCGIFMEDIA. To solve the issue of newly attached interfaces having LINK_STATE_UNKNOWN or some interfaces not even changing it, we only change the local knowledge of interface flags when reports them by getifaddrs(3) or route(4) when we change them. For example, if we set IFF_UP and it succeeds we don't set this internally until reported by the kernel as above. This keeps flags and link state in sync with each other. The hope is that the kernel can set the real link state before it reports IFF_UP. As such, we no longer require the poll option or need to enter a tight loop for old interfaces.
* BSD: Detect initial link state in ifa_dataRoy Marples2020-09-22
| | | | | | | | | | | Not all interfaces report media state to get the link state. However, link state is available from getifaddrs(3) ifa_data for AF_LINK addresses. Testing shows that link state is also sent correctly via route(4) messages for the same interface. This makes pppoe(4) interfaces more reliable on FreeBSD and OpenBSD.
* Adjust prior so that message is logged before starting devRoy Marples2020-09-19
| | | | Also add os_init incase other os need similar in the future.
* Linux: detect network namespace and deny udev in oneRoy Marples2020-09-19
| | | | | | | | | | udev says whether an interface name is stable or not. In a network namespace, udev claims the interface does not exist. This makes sense because udev only operates in the root namespace. As such disable udev in a network namespace. While here correctly spell initialise.
* if: introduce xsocketpair, similar to xsocketRoy Marples2020-09-05
| | | | | Old systems don't have SOCK_CLOEXEC, etc, this makes it easy. While here, right limit the sockets.
* dhcpcd: Add an option to poll the interface carrier stateRoy Marples2020-06-18
| | | | | Only to be used if the interface does not report carrier state changes for whatever reason.
* privsep: Remove pledges inet and dns from the master processRoy Marples2020-06-05
| | | | | | | | | Achieved by adding IPC to ignore interfaces names based on the interface group. This means every process just pledges stdio for IPC which the exception of the master process which also pledges route so it can access the routing table.
* privsep: Drain the link socket as we can't re-open it.Roy Marples2020-05-30
| | | | Add debug per 100 messages.
* Solaris: IP_RECVIF is busted on DilOS at leastRoy Marples2020-05-29
| | | | | Luckily Solaris supports IP_PKTINFO as well so lets fall back to that for the time being.
* privsep: Enable Capsicum for all processes.Roy Marples2020-05-19
| | | | | | | | | | | | | | | | | Except for the priviledged process. This is quite an in-depth change: * ARP is now one process per address * BPF flags are now returned via privsep * BPF write filters are locked when supported * The root process sends to the network The last step is done by opening RAW sockets and then sending a UDP header (where applicable) to avoid binding to an address which is already in use by the reader sockets. This is slightly wasteful for OS's without sandboxing but does have the very nice side effect of not needing a source address to unicast DHCPs replies from which makes the code smaller.
* privsep: Handle all file IO in the Priviledged ActioneerRoy Marples2020-05-12
| | | | | | | | | | This allows us to move the database directory back into the root of the filesystem. While here, harden the files by denying any user read access to them. As part of this change, init the DUID from any machine data and cache the default DHCP vendor field before dropping priviledges as we may lose access to this later.
* privsep: Implement pledge(2) support as found on OpenBSDRoy Marples2020-05-10
|
* inet6: Add 'temporary' directive to the slaac optionRoy Marples2020-04-19
| | | | | | | | This instructs dhcpcd to create a temporary address for each address generated from a RA. As such, dhcpcd no longer looks at the kernel option for it as the functionality is being removed from some or never existed in the first place.
* if: Decode vlid from the interface nameRoy Marples2020-02-15
| | | | This just clarifies the former fix
* BSD: Add support for RO_MISSFILTER route(4) socket optionRoy Marples2020-02-08
| | | | | | This allows dhcpcd to only listen for RTM_MISS generated by default routers dhcpcd *could* install so if one becomes unreachable we can pick another.
* ARP: Recalculate ARP buffer taking into account max frame lengthRoy Marples2020-02-05
|
* DHCP: Support jumbo framesRoy Marples2020-02-05
| | | | | Also important as we now need to store the frame header in the initial buffer.
* Implement Anonymity Profiles for DHCP Clients, RFC 7844Roy Marples2020-01-15
| | | | | | | | | | | | | | This works by randomising the hardware address when carrier is down and using this to construct a DUID LL which is used over any saved DUID. IAID is defaulted to zero and hostname + FQDN are disabled. Then every possible option is masked out except for essential ones. It's possible to request options *after* anonymous option which will enable it. This is RFC compliant and allows 100% flexability in letting the user decide what, if any, details leek out. This is disabled by default. Only works on NetBSD, other OS coming shortly.
* ioctl: The POSIX signature differs from BSD and glibcRoy Marples2020-01-08
| | | | | | | | | | BSD and glibc have the signature for request as unsigned long. musl and Solaris have a signed int. As such, we need to detect this at compile time and adjust the signature of our internal ioctl functions to match. To keep the onwire format the same, memcpy the request to the unsigned long request and back again, thus preserving the signedness.
* Welcome to 2020!Roy Marples2020-01-03
|
* privsep: Add support for priviledge separationRoy Marples2019-11-28
| | | | | | | | | | | | | | | | | | | | | | | | Not enabled by default - enable with ./configure --enable-privsep Requires a user added to the system - default _dhcpcd Several processes will be spawned off the main state engine: a privileged actioneer and a generic network proxy. Only the privileged actioneer process will retain root permissions. When required, the privileged actioneer will also spawn BPF listeners for BOOTP (DHCP) and ARP. The BOOTP BPF listener should be a short lived process. On kernels with RFC 5227 support, the ARP BPF listener will only be used for ARPing and announcing a preferred address and will also be a short lived process. When not running in master mode, an address listener will be spawned for each address (with the exception of RA dervived addresses) dhcpcd cares about. TODO: * Solaris support. * ARP BPF address filtering.
* INET6: Apply hoplimit, reachable and retrans timer values from RA.Roy Marples2019-11-09
| | | | | Only tested thus far on NetBSD. While here, fix prior to not lose the first sorted route.
* BSD: Disable kernel RTADV sysctl earlierRoy Marples2019-11-04
| | | | Just makes life a bit easier.
* BSD: Ignore interface groups as we would the interface nameRoy Marples2019-10-09
| | | | Incase someone renames tap0 to foo4.
* if: Ignore TAP interfaces by defaultRoy Marples2019-10-09
| | | | | | | TAP interfaces are virtual ethernet and not really distinguishable from real interfaces other than the interface name. On BSD the interfaces are always called tapN.
* Solaris: Get the subnet in ipv6 ifa handlerRoy Marples2019-09-04
| | | | | This simplifies the code and allows onlink route "addresses" to work on P2P interfaces.
* IP: Work with IP headers with options.Roy Marples2019-07-30
|
* Add SPDX identifiers to all dhcpcd source files.Yegor Yefremov2019-07-04
| | | | See https://spdx.org/ for details.
* Merge branch 'master' into rbtreeRoy Marples2019-05-04
|\
| * BSD: RTM_IFINFO is not emitted for all interfaces past unknown linkRoy Marples2019-05-02
| | | | | | | | | | It has to work for wireless interfaces, but we have no idea about other interfaces. So test valid carrier for unknown.
* | Merge branch 'master' into rbtreeRoy Marples2019-04-16
|\|
| * if: Add a generic function to create an aliased address nameRoy Marples2019-04-16
| | | | | | | | | | | | Reduces complexity between IPv4 and IPv6 and silences a warning about potential string trunctaion if the LUN makes too big an interface name.
| * sun: Fix carrier detection, MTU detection and plumbingRoy Marples2019-04-14
| | | | | | | | dhcpcd no longer needs ifconfig to do the initial plumbing.
* | route: Remove kroutes and make froutes optionalRoy Marples2019-03-05
| | | | | | | | | | | | | | | | This is an attempt to reduce the memory dhcpcd uses. By removing kroutes and froutes from global context. kroutes are generated at the start of rt_build and freed at the end.
* | if: No more need for interface sortingRoy Marples2019-03-04
|/
* Fold all CMSG parsing into a common function.Roy Marples2019-02-19
| | | | Makes dhcpcd smaller still.
* ip6: Implement IPv6 address sharingRoy Marples2019-01-05
| | | | | | | | | | | | | | | This allows the same IPv6 address to exist on more than one interface. Whenever dhcpcd address an IPv6 address, it will advertise it along with the hardware address of the preferred interface. This is heavliy reliant on the kernel supporting this as it's the kernel that handle the Duplicate Address Detection. In a nutshell it needs to support RFC 7527 and ignore NA packets from any hardware address the host owns. Currently the only known kernel that fully supports this is NetBSD-8.99.27
* Welcome to 2019!Roy Marples2019-01-01
|
* link: detect buffer overflow / desync and relearn interface stateRoy Marples2018-03-19
| | | | | | | | | | | | It's possible for the internal kernel buffer that reports network events to overflow. On Linux and NetBSD* this is handled by ENOBUFS being returned by recv(2). On OpenBSD there is a special route(4) message RTM_DESYNC. All other OS's don't seem to report this error, so dhcpcd cannot detect it. * I will commit a patch to NetBSD soon for this and will request a pullup to NetBSD-8.
* inet6: simplify setup of kernelRoy Marples2018-02-02
| | | | | | | Rename if_checkipv6 to if_setup_inet6 so it's more descriptive. simpify code as we don't really care about the result. Restore the prior behavior of not disabling kernel RA handling if dhcpcd is not doing it.
* Welcome to 2018.Roy Marples2018-01-01
|
* dhcp6: don't listen on IPv6 addresses when not using DHCP6Roy Marples2017-12-07
| | | | | To achieve this we need to learn the addresses AFTER the interface configuration has been loaded.
* Hardware Address validationRoy Marples2017-05-22
| | | | | | | | | | | | | | | | | | Summary: The all zero's and all one's hardware address are reserved. As such, they should not be used in dhcpcd. Likewise, Router Solicitation messages should not contain an all zero source address option. Fixes T119. Test Plan: Request IPv6RA over a PPP interface on a suitable OS which assigns an all zero's or all one's hardware address. Maniphest Tasks: T119 Differential Revision: https://dev.marples.name/D114
* Detect VLANID to use in IAID.Roy Marples2017-04-23
| | | | | | | | | | | | | | | | | | | | | Summary: This only works if the VLAN interface has already been setup prior to starting dhcpcd. Initial fix for T115. Test Plan: Configure a vlan interface. Don't set any iaid in /etc/dhcpcd.conf. Start dhcpcd, check VLANID is used for IAID. Reviewers: sthen Reviewed By: sthen Tags: #dhcpcd Differential Revision: https://dev.marples.name/D107
* These functions are AF agnostic now.Roy Marples2017-03-31
|
* Remove ipv6ra_own and ipv6ra_own_default options.Roy Marples2017-03-24
| | | | This is controllable via noipv6 and noipv6rs options.