summaryrefslogtreecommitdiff
path: root/sys/netinet/if_arp.c
AgeCommit message (Collapse)Author
2022-11-15arp: Validate ARP source hardware address matches Ethernet sourceroy
RFC 5227 section 1.1 states that for a DaD ARP probe the sender hardware address must match the hardware address of the interface sending the packet. We can now verify this by checking the mbuf tag PACKET_TAG_ETHERNET_SRC. This fixes an obsure issue where an old router was sending out bogus ARP probes. Thanks to Ryo Shimizu <ryo@nerv.org> for the re-implementation.
2022-11-15Revert prior.roy
2022-11-14arp: Validate L2 sender hardware address matches ARP proberoy
RFC 5227 section 1.1 states that for a DaD ARP probe the sender hardware address must match the hardware address of the interface sending the packet. We can now verify this by checking the mbuf packet header. This fixes an obsure issue where an old router was sending out bogus ARP probes.
2022-09-03Convert ARP from a legacy netisr to pktqueue.thorpej
2021-02-19- Make ALIGNED_POINTER use __alignof(t) instead of sizeof(t). This is morechristos
correct because it works with non-primitive types and provides the ABI alignment for the type the compiler will use. - Remove all the *_HDR_ALIGNMENT macros and asserts - Replace POINTER_ALIGNED_P with ACCESSIBLE_POINTER which is identical to ALIGNED_POINTER, but returns that the pointer is always aligned if the CPU supports unaligned accesses. [ as proposed in tech-kern ]
2021-02-16One more time: backout arp header alignment, now that the alignmentmartin
asserted has been aligned to reality. Also remove unused ARP_HDR_ALIGNED_P macro. Pointed out by roy.
2021-02-16Undo previous backout: alignment is needed here.martin
The reason for the previous backout was a misunderstanding (POINTER_ALIGNED_P was broken, but the assertion fired even after it got fixed).
2021-02-15Undo previous; POINTER_ALIGNED_P was broken.christos
2021-02-15put back alignment (reported by martin@)christos
2021-02-14- centralize header align and pullup into a single inline functionchristos
- use a single macro to align pointers and expose the alignment, instead of hard-coding 3 in 1/2 the macros. - fix an issue in the ipv6 lt2p where it was aligning for ipv4 and pulling for ipv6.
2021-02-14if_arp: Just KASSERT that arphrd is alignedroy
While here improve readability of checking ARP IEEE1394 matches interface.
2021-02-13Prior alignment fixes should not use an offsetroy
2021-02-13if_arp: Ensure that arphdr is alignedroy
2021-02-02arp: Plug an mbuf leakyamt
2020-09-15Implement RFC 7048, making Neighbor Unreachability Detection less impatientroy
RFC 7048 Section 3 says in the UNREACHABLE state packets continue to be sent to the link-layer address and then backoff exponentially. We adjust this slightly and move to the INCOMPLETE state after `nd_mmaxtries` probes and then start backing off. This results in simpler code whilst providing a more robust model which doubles the time to failure over what we did before. We don't want to be back to the old ARP model where no unreachability errors are returned because very few applications would look at unreachability hints provided such as ND_LLINFO_UNREACHABLE or RTM_MISS.
2020-09-14nd: Name l3addr union of llentry and use in-place of nd_addr.roy
Probably makes more sense and makes nd.h less messy.
2020-09-11ARP: Use ND rather than our own.roy
This brings the benefit of Neighbour Unreachability Detection which is something ARP sorely lacks. The new timings mirror those of IPv6 and are adjustable via sysctl(8). Unlike IPv6 ND, these are global and not per interface.
2020-03-09route: RTM_MISS now puts the message source address in RTA_AUTHORroy
route(8) also reports this. A userland app could use this to blacklist nodes who probe for machines that doesn't exist on a subnet / prefix.
2020-03-09arp: report RTM_MISS when removing an unresolved entry in the arp tableroy
Otherwise we only get it when renewing and we've sent too many requests. This mirrors INET6 behaviour.
2020-01-23arp: find source address then target address when processing inputroy
This fixes the case where another host having a duplicate ip address starts using it right away without probing for it's availability. While here, prefer ifatoia over a strict cast.
2020-01-20Remove FDDI support.thorpej
2020-01-19Remove Token Ring support.thorpej
2019-10-11ARP: Don't defend ARP probes.roy
We should let the nature of ARP takes it's course here when our address is neither tentative nor duplicated. This allows the host to work with ARP ping, which was broken in r1.279.
2019-09-25Initialize DAD components properlyozaki-r
The original code initialized each component in non-init functions such as arp_dad_start and nd6_dad_find, conditionally based on a global flag for each. However, it was racy because the flag and the code around it were not protected by a lock and could cause a kernel panic at worst. Fix the issue by initializing the components in bootup as usual.
2019-09-01inet: Send RTM_MISS when we fail to resolve an address.roy
Takes the same approach as when adding a new address - we no longer announce the new lladdr right away but we announce the result. This will either be RTM_ADD or RTM_MISS. RTM_DELETE is only sent if we have a lladdr assigned OR gc'ed. This tells us when a new lladdr has been added (RTM_ADD), changed (RTM_CHANGE), deleted (RTM_DELETED) or has failed to been resolved (RTM_MISS). The latter case can be interpreted as unreachable.
2019-08-30ARP: change default sysctl entry log_movements to 0roy
IP address sharing is a thing and shouldn't cause needless diagnostics by default.
2019-08-30ARP: remove unused sysctl entry log_unknown_networkroy
2019-08-22rtsock: rework rt_clonedmsg to take a message type and lladdrroy
We will use this in a future patch to notify userland of lladdr changes. XXX pullup -8 -9
2019-08-19Initialize dom_mowner for MBUFTRACEozaki-r
2019-04-29Introduce rt_addrmsg_src which adds RTA_AUTHOR to the message.roy
Use this when we notify userland of a duplicate address and set RTA_AUTHOR to the hardware address of the sender. While here, match the logging diagnostic of INET6 to the simpler one of INET so it's consistent.
2019-04-29Move lla_snprintf from if_arp.c to dl_print.croy
2019-04-29rtsock: Route address message simplificationroy
Rename rt_newaddrmsg to rt_addrmsg_rt. Add rt_addrmsg which drops the error and route arguments which are only needed by one caller.
2019-04-24ARP: Enable Address Defence again.roy
Revert the tentative/duplicated check and test for if it's been broadcast or not. This reverts r1.245.
2018-12-22Replace M_ALIGN and MH_ALIGN by m_align.maxv
2018-11-29Introduce and use ip_dad_enabled() and ip6_dad_enabled() functionsozaki-r
2018-10-30Avoid double rt_replace_ifa on rtrequest1(RTM_ADD)ozaki-r
Some callers of rtrequest1(RTM_ADD) adjust rt_ifa of an rtentry created by rtrequest1 that may change rt_ifa (in ifa_rtrequest) with another ifa that is different from requested one. It's wasteful and even worse introduces a race condition. rtrequest1 should just use a passed ifa as is if a caller hopes so.
2018-05-11staticmaxv
2018-05-01Remove now unused net_osdep.h includes, the other BSDs did the same.maxv
2018-04-11Add XXX.maxv
2018-04-10Remove unused mbuf argument from arpcreate() and arplookup().maxv
2018-03-08Fix a race condition on DAD destructions (again)ozaki-r
The previous fix to DAD timers was wrong; it avoided a use-after-free but instead introduced a memory leak. The destruction method had delegated a destruction of a DAD timer to the timer itself and told that by setting NULL to dp->dad_ifa. However, the previous fix made DAD timers do nothing on the sign. Fixing the issue with using callout_stop isn't easy. One approach is to have a refcount on dp but it introduces extra complexity that we want to avoid. The new fix falls back to using callout_halt, which was abandoned because of softnet_lock. Fortunately now the network stack is protected by KERNEL_LOCK so we can remove softnet_lock from DAD timers (callout) and use callout_halt safely.
2018-03-06Fix reference leaks of llentryozaki-r
callout_reset and callout_halt can cancel a pending callout without telling us. Detect a cancel and remove a reference by using callout_pending and callout_stop (it's a bit tricy though, we can detect it). While here, we can remove remaining abuses of mutex_owned for softnet_lock.
2018-03-06Tweak sanity checksozaki-r
Scheduling a timer of static entries is wrong.
2018-03-01Sprinkle some const.roy
2018-02-24Avoid a race condition of DAD timer destructionsozaki-r
When we see dp->dad_ifa == NULL, it means that the ifa is being deleted and also the callout is scheduled again by someone. We shouldn't rely on a result of callout_pending to know if the callout is scheduled because it returns false if the subsequent callout handler is already on the fly. We have to always delegate the destruction of dp to the subsequent handler unconditionally if dp->dad_ifa == NULL. Otherwise, the first handler destroys the dp and the second handler tries to handle destroyed dp.
2018-02-14Remove IFF_STATICARP, we don't support this, and the code is useless in itsmaxv
current form. ok ozaki-r@
2018-02-13Mmh. Add a missing check: if ARP was disabled on the interface, don'tmaxv
process ARP packets. Otherwise the kernel will add ARP entries even if ifconfig wm0 -arp was entered.
2018-02-13Be tougher:maxv
* In arpintr(), don't allow IEEE1394 packets on non-IEEE1394 interfaces. * In revarpinput(), kick IEEE1394 packets right away. They are not supported.
2018-02-13Same change as rev1.258, but this time in revarpinput: use m_pullup.maxv
2018-02-13Minor stylistic changes, and use C99 types.maxv