aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ndp
Commit message (Collapse)AuthorAgeFilesLines
* ndp: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])Elyes Haouas2024-04-291-4/+4
| | | | | Pull Request: https://github.com/freebsd/freebsd-src/pull/888 Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
* ndp(8): increase buffer size in rtsock modeBoris Lytochkin2024-02-191-0/+6
| | | | | | | | | | | | | | On a router with many connected devices (~10k+) `ndp -an` can fail with ENOMEM because of some additional NDP records were added between sysctl() buffer size estimate and data fetch calls. Allocate more space based on size estimate: 1/64 (~2%) of additional space, but not less that 4 m_rtmsg structures. Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D43956
* usr.sbin: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* ndp: improve -c and -d handling in ndp_netlinkR. Christian McDonald2023-10-233-9/+14
| | | | | | | | | | | | | | | This patch restores/fixes some of the behavior present in pre-netlink ndp(8). 1. Deleting a local address now correctly returns EPERM (instead of ENOENT) 2. ndp -c no longer dumps the entire table while complaining about local addresses 3. Return exit code when deleting entry (e.g. trying ndp -d on a local address is an error) Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42316
* ndp: fix timestamp display outputR. Christian McDonald2023-10-171-1/+1
| | | | | | | | | | | The current xo_format string is incorrect. This restores the display format prior to libxo-ification work while also explicitly marking tv_sec and tv_usec as encoded output only. MFC after: 1 week Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42269
* netlink: cope with growing requestsKristof Provost2023-10-171-6/+6
| | | | | | | | | | | | | If a request ends up growing beyong the initially allocated space the netlink functions (such as snl_add_msg_attr_u32()) will allocate a new buffer. This invalidates the header pointer we can have received from snl_create_msg_request(). Always use the hdr returned by snl_finalize_msg(). Reviewed by: melifaro MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42223
* ndp: cope with unresolved neighboursKristof Provost2023-09-181-2/+5
| | | | | | | | | | | | | | | | | If we've not (yet) resolved a neighbour nda_lladdr will be NULL, and NLA_DATA_LEN(neigh->nda_lladdr) will dereference a NULL pointer. Avoid that by checking nda_lladdr first, and only dereferencing if it's not NULL. Test case: ping6 -c 1 <non-existant neighbour> ndp -a Reviewed by: melifaro MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D41903
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* Mark usage function as __dead2 in programs where it does not returnAlfonso Gregory2023-07-071-1/+1
| | | | | | | | In most cases, usage does not return, so mark them as __dead2. For the cases where they do return, they have not been marked __dead2. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/735
* ndp: Prepare for pending tcpdump updateJoseph Mingrone2023-06-083-7/+20
| | | | | | | | | ndp makes use of gmt2local, however that library has been removed from tcpdump. Add utc_offset() as a substitute. Reviewed by: emaste, jhb, melifaro Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40445
* netlink: update rta_multipath conditions in arp/ndp after 656a39c1a062Alexander V. Chernikov2023-05-271-1/+1
|
* arp/ndp: Use valid prototypes for function declarations with no arguments.John Baldwin2023-04-261-1/+1
|
* ndp: fix signed/unsigned compariosn in the netlink code.Alexander V. Chernikov2023-04-251-1/+1
|
* ndp: convert ndp(8) to netlink.Alexander V. Chernikov2023-04-254-69/+661
| | | | | | | | The change is intended to be fully transparent to the users. Similarly to route(8) and netstat(8), ndp can be build without netlink by defining WITHOUT_NETLINK in make.conf. Differential Revision: https://reviews.freebsd.org/D39720
* ndp: Use valid prototypes for function declarations with no arguments.John Baldwin2023-04-241-8/+8
| | | | | Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D39729
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+1
|
* ndp(8): add structured output formatting via libxoAlexander V. Chernikov2022-07-082-137/+253
| | | | | Differential Revision: https://reviews.freebsd.org/D35677 MFC after: 2 weeks
* Fix arp/ndp deletion broken by 2fe5a79425c7.Alexander V. Chernikov2021-02-191-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Changes in the 2fe5a79425c7 moved dst sockaddr masking from the routing control plane to the rtsock code. It broke arp/ndp deletion. It turns out, arp/ndp perform RTM_GET request first to get an interface index necessary for the deletion. Then they simply stamp the reply with RTF_LLDATA and set the command to RTM_DELETE. As a result, kernel receives request with non-empty RTA_NETMASK and clears RTA_DST host bits before passing the message to the lla code. De facto, the only needed bits are RTA_DST, RTA_GATEWAY and the subset of rtm_flags. With that in mind, fix the interace by clearing RTA_NETMASK for every messages with RTF_LLDATA. While here, cleanup arp/ndp code a bit. MFC after: 1 day Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D28804
* Update the "flag" for draft-ietf-6man-ipv6only-flag.Bjoern A. Zeeb2018-11-031-1/+1
| | | | | | | | | Having the flag named "6" can possibly be a problem for configurations where parsing strings and numbers can produce ambivalent results. Rename the "6" flag to the "S"ix (or Silence-IPv4) flag. Notes: svn path=/head/; revision=340098
* Initial implementation of draft-ietf-6man-ipv6only-flag.Bjoern A. Zeeb2018-10-302-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change defines the RA "6" (IPv6-Only) flag which routers may advertise, kernel logic to check if all routers on a link have the flag set and accordingly update a per-interface flag. If all routers agree that it is an IPv6-only link, ether_output_frame(), based on the interface flag, will filter out all ETHERTYPE_IP/ARP frames, drop them, and return EAFNOSUPPORT to upper layers. The change also updates ndp to show the "6" flag, ifconfig to display the IPV6_ONLY nd6 flag if set, and rtadvd to allow announcing the flag. Further changes to tcpdump (contrib code) are availble and will be upstreamed. Tested the code (slightly earlier version) with 2 FreeBSD IPv6 routers, a FreeBSD laptop on ethernet as well as wifi, and with Win10 and OSX clients (which did not fall over with the "6" flag set but not understood). We may also want to (a) implement and RX filter, and (b) over time enahnce user space to, say, stop dhclient from running when the interface flag is set. Also we might want to start IPv6 before IPv4 in the future. All the code is hidden under the EXPERIMENTAL option and not compiled by default as the draft is a work-in-progress and we cannot rely on the fact that IANA will assign the bits as requested by the draft and hence they may change. Dear 6man, you have running code. Discussed with: Bob Hinden, Brian E Carpenter Notes: svn path=/head/; revision=339929
* usr.sbin/ndp: Cleanup in preparation to add libxo supportRenato Botelho2018-08-232-37/+42
| | | | | | | | | | | | | | | | | | | * Constify rtpref_str declaration * Remove unused h_errno declaration * Use time_t type for expire * Use strlcpy to set static "?" value to ifname * Rename local variable 's' to stop shadowing global definition * Close socket used in pfx_flush() * Use local variables for sock() in setdefif() and getdefif() * Increase WARNS to 3 Reviewed by: allanjude, kevans Approved by: allanjude Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D11118 Notes: svn path=/head/; revision=338243
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Fix userland tools that don't check the format of routing socketPatrick Kelsey2017-04-161-1/+2
| | | | | | | | | | | | | | | | | | | messages before accessing message fields that may not be present, removing dead/duplicate/misleading code along the way. Document the message format for each routing socket message in route.h. Fix a bug in usr.bin/netstat introduced in r287351 that resulted in pointer computation with essentially random 16-bit offsets and dereferencing of the results. Reviewed by: ae MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D10330 Notes: svn path=/head/; revision=317035
* usr.sbin: normalize paths using SRCTOP-relative paths or :H when possibleEnji Cooper2017-03-041-2/+2
| | | | | | | | | | This simplifies make logic/output MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314659
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Fix style(9)Renato Botelho2017-02-141-40/+40
| | | | | | | | | | | Reviewed by: allanjude, vangyzen Approved by: allanjude MFC after: 1 week Sponsored by: Rubicon Communications (Netgate) Differential Revision: https://reviews.freebsd.org/D9510 Notes: svn path=/head/; revision=313737
* Fix indent after r292333.Hajimu UMEMOTO2015-12-191-16/+16
| | | | Notes: svn path=/head/; revision=292465
* Provide additional lle data in IPv6 lltable dump used by ndp(8).Alexander V. Chernikov2015-12-161-42/+36
| | | | | | | | | | | | | | | | | | Before the change, things like lle state were queried via SIOCGNBRINFO_IN6 by ndp(8) for _each_ lle entry in dump. This ioctl was added in 1999, probably to avoid touching rtsock code. This change maps SIOCGNBRINFO_IN6 data to standard rtsock dump the following way: expire (already) maps to rtm_rmx.rmx_expire isrouter -> rtm_flags & RTF_GATEWAY asked -> rtm_rmx.rmx_pksent state -> rtm_rmx.rmx_state (maps to rmx_weight via define) Reviewed by: ae Notes: svn path=/head/; revision=292333
* Fix a ton of speelling errorsEitan Adler2015-10-211-1/+1
| | | | | | | | | | arc lint is helpful Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com Differential Revision: https://reviews.freebsd.org/D3337 Notes: svn path=/head/; revision=289677
* rtsock requests for deleting interface address lles started to return EPERMAlexander V. Chernikov2015-09-271-0/+2
| | | | | | | | | | | | instead of old "ignore-and-return 0" in r287789. This broke arp -da / ndp -cn behavior (they exit on rtsock command failure). Fix this by translating LLE_IFADDR to RTM_PINNED flag, passing it to userland and making arp/ndp ignore these entries in batched delete. MFC after: 2 weeks Notes: svn path=/head/; revision=288297
* 'sin' is never used after assignment. Looking at the context, it seemsXin LI2015-09-191-1/+1
| | | | | | | | | | | that it belongs the commented out section of code so make it part of that section. Reported by: clang static analyzer MFC after: 2 weeks Notes: svn path=/head/; revision=287995
* Add static and remove unused variables.Hiroki Sato2015-08-241-44/+50
| | | | Notes: svn path=/head/; revision=287097
* Remove obsolete API (SIOCGDRLST_IN6 and SIOCGPRLST_IN6) support.Hiroki Sato2015-08-241-201/+0
| | | | Notes: svn path=/head/; revision=287095
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-271-1/+0
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge head from 7/28Simon J. Gerraty2014-08-192-14/+36
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=270164
| * | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | Merge headSimon J. Gerraty2014-04-281-45/+23
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265044
| * \ \ Merge from headSimon J. Gerraty2013-09-052-24/+55
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=255263
| * | | | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | | | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | | | Sync with HEAD.David E. O'Brien2013-02-082-57/+25
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246555
| * \ \ \ \ Sync from headSimon J. Gerraty2012-11-042-17/+1
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=242545
| * | | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | | | | Stop including if_var.h from userland.Gleb Smirnoff2015-04-061-1/+0
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=281143