summaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet/arp.c
AgeCommit message (Collapse)AuthorFilesLines
2019-08-02ethernet: fix ARP feature arc definitionDave Barach1-2/+9
This patch gets rid of an ugly warning during vpp startup: "vnet_feature_init:143: WARNING: arp arc: last node is arp-disabled, but expected error-drop!" Type: fix Fixes: 1ff56f00ca015e82ef29955986e503913d1c3b86 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I80914a3c113c090a09bd5a5131e39f036871d92e
2019-08-01ethernet: Fix node ordering on ARP feautre ARCNeale Ranns1-2/+13
Type: fix Fixes: fe2fff37 this improves the tracing for dropped ARP packets Change-Id: Iefd0391e349fc54f1beebda403b2349534b20c48 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-07-10ip: fix show ip neigh vector read overflowBenoît Ganne1-19/+6
Both format_ethernet_arp_ip4_entry() and format_ip6_neighbor_ip6_entry() used %s to format flags which is a vector and not a null-terminated C-string. Introduce format_ip_neighbor_flags() instead. Type: fix Fixes: 102ec52bc4 Change-Id: I0c9349fefbeb76471933de358acceb50512a21aa Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-07-05ethernet: ARP disabled nodeNeale Ranns1-15/+106
Type: feature improve the tracing from: 00:00:01:259665: pg-input stream pcap3, 42 bytes, 3 sw_if_index current data 0, length 42, buffer-pool 0, ref-count 1, trace handle 0x0 ARP: 02:03:00:00:ff:02 -> ff:ff:ff:ff:ff:ff request, type ethernet/IP4, address size 6/4 02:03:00:00:ff:02/172.16.3.5 -> 00:00:00:00:00:00/172.16.2.1 00:00:01:259690: ethernet-input frame: flags 0x1, hw-if-index 3, sw-if-index 3 ARP: 02:03:00:00:ff:02 -> ff:ff:ff:ff:ff:ff 00:00:01:259702: arp-input request, type ethernet/IP4, address size 6/4 02:03:00:00:ff:02/172.16.3.5 -> 00:00:00:00:00:00/172.16.2.1 00:00:01:259710: error-drop rx:pg2 00:00:01:259717: drop null-node: blackholed packets to 00:00:01:283323: pg-input stream pcap3, 42 bytes, 3 sw_if_index current data 0, length 42, buffer-pool 0, ref-count 1, trace handle 0x0 ARP: 02:03:00:00:ff:02 -> ff:ff:ff:ff:ff:ff request, type ethernet/IP4, address size 6/4 02:03:00:00:ff:02/172.16.3.5 -> 00:00:00:00:00:00/172.16.2.1 00:00:01:283348: ethernet-input frame: flags 0x1, hw-if-index 3, sw-if-index 3 ARP: 02:03:00:00:ff:02 -> ff:ff:ff:ff:ff:ff 00:00:01:283360: arp-input request, type ethernet/IP4, address size 6/4 02:03:00:00:ff:02/172.16.3.5 -> 00:00:00:00:00:00/172.16.2.1 00:00:01:283369: arp-disabled request, type ethernet/IP4, address size 6/4 02:03:00:00:ff:02/172.16.3.5 -> 00:00:00:00:00:00/172.16.2.1 00:00:01:283374: error-drop rx:pg2 00:00:01:283380: drop arp-disabled: ARP Disabled on this interface Change-Id: I49b915b84cf56d6c138dedd8a596c045c150c4fb Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-07-02ip: check all fib src for a connected dst entryBenoît Ganne1-25/+53
When looking for a connected fib entry matching the ARP destination, there can be other DPO interposed prior to the connected one. Type: fix Change-Id: I9b4ab387fb08acf9879d5fda3791e6572a099492 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-06-03ARP: add feature arcNeale Ranns1-142/+465
- arp-input, registered with the ethernet protocol dispatcher, performs basic checks and starts the arc - arp-reply; first feature on the arc replies to requests and learns from responses (no functional change) - arp-proxy; checks against the proxy DB arp-reply and arp-proxy are enabled when the interface is appropriately configured. Change-Id: I7d1bbabdb8c8b8187cac75e663daa4a5a7ce382a Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-05-16init / exit function orderingDave Barach1-6/+6
The vlib init function subsystem now supports a mix of procedural and formally-specified ordering constraints. We should eliminate procedural knowledge wherever possible. The following schemes are *roughly* equivalent: static clib_error_t *init_runs_first (vlib_main_t *vm) { clib_error_t *error; ... do some stuff... if ((error = vlib_call_init_function (init_runs_next))) return error; ... } VLIB_INIT_FUNCTION (init_runs_first); and static clib_error_t *init_runs_first (vlib_main_t *vm) { ... do some stuff... } VLIB_INIT_FUNCTION (init_runs_first) = { .runs_before = VLIB_INITS("init_runs_next"), }; The first form will [most likely] call "init_runs_next" on the spot. The second form means that "init_runs_first" runs before "init_runs_next," possibly much earlier in the sequence. Please DO NOT construct sets of init functions where A before B actually means A *right before* B. It's not necessary - simply combine A and B - and it leads to hugely annoying debugging exercises when trying to switch from ad-hoc procedural ordering constraints to formal ordering constraints. Change-Id: I5e4353503bf43b4acb11a45fb33c79a5ade8426c Signed-off-by: Dave Barach <dave@barachs.net>
2019-03-28Typos. A bunch of typos I've been collecting.Paul Vinciguerra1-5/+5
Change-Id: I53ab8d17914e6563110354e4052109ac02bf8f3b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-05L2: ARP term - learn but don't send response to GARPsNeale Ranns1-0/+3
Change-Id: I766767d27f37493dc9f2bde1297c1b620cd1e321 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-02-22Callback functions must have the correct signatureNeale Ranns1-1/+3
Change-Id: I642823bdc3c7006a0b719ec1e3a9cd75b2b37253 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-01-30Use IP and MAC API types for neighborsNeale Ranns1-113/+113
use address_t and mac_address_t for IPv6 and ARP entries and all other API calls in ip.api aprat from the route ones, that will follow in a separate commit Change-Id: I67161737c2184d3f8fc1e79ebd2b55121c5b0191 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-01-23IP route local and connectedNeale Ranns1-1/+5
allow routes that are local and connected to be added via the API. this emulates the addition of a second address in the same subnet added to an interface. Change-Id: Ib18a08c26956be9a07b3360664210c8cf6734c84 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-11-21VPP-1309: fixed crash when listing ip arp after removing interfacePavel Kotucek1-0/+24
Change-Id: I8f88214eab0535573863f31d2c21e2239a811921 Signed-off-by: Pavel Kotucek <pavel.kotucek@pantheon.tech>
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach1-22/+24
Change-Id: Id4f37f5d4a03160572954a416efa1ef9b3d79ad1 Signed-off-by: Dave Barach <dave@barachs.net>
2018-09-24ARP: don't use RPC for requests initiated from the main threadNeale Ranns1-111/+80
Change-Id: If833680149eb33db6adc836c5330f350042869f4 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-09-08L2 BVI/FIB: Update L2 FIB table when BVI's MAC changesNeale Ranns1-0/+1
also some moving of l2 headers to reduce dependencies Change-Id: I7a700a411a91451ef13fd65f9c90de2432b793bb Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-07-30FIB: return entry prefix by const reference to avoid the copyNeale Ranns1-7/+8
Change-Id: I09b8406168df4b6b28df3ede24ee839681be0195 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-07-20IP directed broadcastNeale Ranns1-0/+9
with ip direct broadcast enable a packet to the interface's subnet broadcast address with be sent L2 broadcast on the interface. dissabled, it will be dropped. it is disabled by default, which preserves current behaviour Change-Id: If154cb92e64834e97a541b32624354348a0eafb3 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-07-14Improve IP4 ARP and IP6 ND Events Notificationv18.10-rc0John Lo1-10/+25
For L2 ARP termination, use both brodcast ARP request and reply packets to provide MAC/IP binding events. For IP4/IP6 neighbor adress resolution, send resolution events if there is an address resolution attemp with a static neighbor entry where both IP and MAC matches. This allow probe of an IP neighbor with a static entry to confirm it is responding with a reply matching that of the static entry. Change-Id: Iffb923bb5aea3f9021436735d5ca06e7b24f966f Signed-off-by: John Lo <loj@cisco.com>
2018-06-25Add checks for bad ARP request packets in arp-termination nodeJohn Lo1-12/+9
Check ARP request packet with bad requester MAC/IP address and drop these packets. Also removed useless VRRP check in the node. Change-Id: I2c8a774d291928eb623b3a515f1edf7e338fa760 Signed-off-by: John Lo <loj@cisco.com>
2018-06-19Check get packet template allocation failure (VPP-1321)John Lo1-0/+6
After calling vlib_packet_template_get_packet(), make sure packet buffer is allocated before using it. Change-Id: Idb5199f4e2c9596137b2101e502d611f474a6ffe Signed-off-by: John Lo <loj@cisco.com>
2018-06-08Gratuitous ARP packet handlingNeale Ranns1-8/+33
only learn from a GARP packet if it is an update to an existing entry. Change-Id: I4c1b59cfedb911466e5e4c9756cf53a6676e1909 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-06-07Revert "Allow arp-input node to learn IPv4 neighbors from GARP packets"John Lo1-5/+0
This reverts commit d018870d1b02109fc8b328446f15312fdd2fcd11. Change-Id: I700ade7a25ae5ed72cfed586e50b02492a4f11de Signed-off-by: John Lo <loj@cisco.com>
2018-06-07Allow arp-input node to learn IPv4 neighbors from GARP packetsJohn Lo1-0/+5
Change-Id: I86019f4ff9b0c8c633638fa23341d8ce49099ba6 Signed-off-by: John Lo <loj@cisco.com>
2018-06-05bond: send gratuitous arp when the active slave went down in active-backup modeSteven1-11/+14
- Modify the API send_ip6_na and send_ip4_garp to take sw_if_index instead of vnet_hw_interface_t and add call to build_ethernet_rewrite to support subinterface/vlan - Add code to bonding driver to send an event to bond_process when the first interface becomes active or when the active interface is down - Create a bond_process to walk the interface and the corresponding subinterfaces to send garp/ip6_na when an event is received. - Minor cleanup in bonding/node.c Note: dpdk bonding driver does not send garp/ip6_na for subinterfaces. There is no attempt to fix it here. But the infra is now done and should be easy to add the support. Change-Id: If3ecc4cd0fb3051330f7fa11ca0dab3e18557ce1 Signed-off-by: Steven <sluong@cisco.com>
2018-05-28Fix IP neighbor/arp pool full and static entry handlingJohn Lo1-69/+69
Move handling of IP neighbor pool full into main thread on entry creation and make sure static entriesare not deleted for reuse. Fix IPv6 neighbor handling on interface down and up so that static entries are not deleted. Change-Id: I073794949a41a5b86201e519ebe479febfc506c8 Signed-off-by: John Lo <loj@cisco.com>
2018-05-25ARP proxy dumpsNeale Ranns1-9/+22
Change-Id: I8335ebf266becf2f42bb3f28a17dfed8d9b08f97 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-05-18ARP: Ensure STATIC and DYANMIC ARP flags are mutually exclusive.Jon Loeliger1-3/+9
Change-Id: I44278dea2ee1daa147b0928bfe26e861907a209f Signed-off-by: Jon Loeliger <jdl@netgate.com>
2018-05-11Periodic scan and probe of IP neighbors to maintain neighbor poolsJohn Lo1-3/+13
Scan IPv4 and IPv6 neigbor pool entries once a minute to keep them up to date. The neighbor of an entry is probed if its time-stamp is older than 1 minute. If the neighbor respond, its time-stamp will be updated. If there is no response from a neighbor, its entry will be deleted when the time-stamp of the entry become more than 4 minutes old. Static neighbor entries are not probed nor deleted. Implemented CLI and API to enable and disable priodic scan of IPv4, IPv6 or both types of IP neighbors. CLI is "ip scan-neighbor" and API is "ip_scan_neighbor_enable_disable". Other IP neighbor scan parameters can also be changed from their defaults via the CLI/API. Change-Id: Id1a0a934ace15d03db845aa698bcbb9cdabebfcd Signed-off-by: John Lo <loj@cisco.com>
2018-04-18Mcast rewrite optimisationsNeale Ranns1-3/+2
hard code the address mask offsets. This are protocol specific and only used on ethernet when used at all. Change-Id: Ib1f6f33682f53254ffbb5a241a1583e65420e0c7 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-04-13GBP V2Neale Ranns1-2/+13
update the GBP plugin to implement the full NAT feature set of opflex agent Change-Id: Ic06a039c889445ed0b9087fa1f292634192b0f8d Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-03-20FIB Interpose SourceNeale Ranns1-1/+1
The interpose source allows the source/provider to insert/interpose a DPO in the forwarding chain of the FIB entry ahead of the forwarding provided by the next best source. For example if the API source (i.e the 'control plane') has provided an adjacency for forwarding, then an interpose source (e.g. a monitoring service) couold interpose a replicatte DPO to copy the traffic to another location AND forward using the API's adjacency. To use the interose feature an existing source (i.e FIB_SOURCE_PLUGIN_HI) cn specifiy as a flag FIB_ENTRY_FLAG_INTERPOSE and provide a DPO to interpose. One might also consider using interpose in conjunction with FIB_ENTRY_FLAG_COVER_INHERIT to ensure the interpose object affects all prefixes in the sub-tree. Change-Id: I8b2737b985f8f7c08123406d0491881def347b52 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-02-16Allow providers to override glean behaviourNeale Ranns1-1/+9
and update glean address on local interface MAC change Change-Id: I530826d60c7e9db2b0fa2d45754139d82c5ea807 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-02-15Revert "Allow interface types to override glean adjacency behaivour"Ole Trøan1-5/+1
This reverts commit 8b30e471df4d42214619e1d6c50cc8298426b45f. Change-Id: I99edb236eb0a7f8ba3fba333c3481a710ebcb59c Signed-off-by: Ole Troan <ot@cisco.com>
2018-02-15Allow interface types to override glean adjacency behaivourNeale Ranns1-1/+5
update the glean adj on a local interface MAC change Change-Id: Ia5c5cde424ed0fea3431532cc5abf22b364bbab5 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-01-06VPP-1110 BVI reply ARP that doesn't request BVI loacl IP.zhaoqingling1-0/+6
Change-Id: I66ae618edaa12c2b4e4afe276da689673b02c9cd Signed-off-by: zhaoqingling <zhao.qingling@zte.com.cn>
2017-10-04[aarch64] Fixes CLI crashes on dpaa2 platform.Christophe Fontaine1-1/+1
- always use 'va_args' as pointer in all format_* functions - u32 for all 'indent' params as it's declaration was inconsistent Change-Id: Ic5799309a6b104c9b50fec309cba789c8da99e79 Signed-off-by: Christophe Fontaine <christophe.fontaine@enea.com>
2017-10-03Repair vlib API socket serverDave Barach1-1/+2
- Teach vpp_api_test to send/receive API messages over sockets - Add memfd-based shared memory - Add api messages to create memfd-based shared memory segments - vpp_api_test supports both socket and shared memory segment connections - vpp_api_test pivot from socket to shared memory API messaging - add socket client support to libvlibclient.so - dead client reaper sends ping messages, container-friendly - dead client reaper falls back to kill (<pid>, 0) live checking if e.g. a python app goes silent for tens of seconds - handle ping messages in python client support code - teach show api ring about pairwise shared-memory segments - fix ip probing of already resolved destinations (VPP-998) We'll need this work to implement proper host-stack client isolation Change-Id: Ic23b65f75c854d0393d9a2e9d6b122a9551be769 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-09-25Fix sending GARP/NA on Bonded Interface Active/Backup Link Up/DownJohn Lo1-37/+1
For bonded interface in Active/Backup mode (mode 1), we need to send a GARP/NA packet, if IP address is present, on slave link state change to up or down to help with route convergence. The callback from DPDK happens in a separate thread so we need to make sure RPC call is used to signal the send_garp_na process in the main thread. Also need to fix DPDK polling so the slave links are not polled. Change-Id: If5fd8ea2d28c54dd28726ac403ad366386ce9651 Signed-off-by: John Lo <loj@cisco.com>
2017-09-22IP-MAC,ND:wildcard events,fix sending multiple eventsEyal Bari1-4/+8
wildcard ND events publisher was sending the last event mutiple times Change-Id: I6c30f2de03fa825e79df9005a3cfaaf68ff7ea2f Signed-off-by: Eyal Bari <ebari@cisco.com>
2017-09-18L2BD,ARP-TERM:fix arp query report mechanism+testEyal Bari1-25/+52
previous mechanism was emitting duplicates of last event, when handling multiple arp queries. tests: * arp events sent for graps * duplicate suppression * verify no events when disabled Change-Id: I84adc23980d43b819261eccf02ec056b5cec61df Signed-off-by: Eyal Bari <ebari@cisco.com>
2017-09-11replace uint32_t with u32Neale Ranns1-2/+2
Change-Id: I6cab79c266837a8731adcf78c9e093dfa6be0ead Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-09-11FIB table add/delete APINeale Ranns1-34/+93
part 2; - this adds the code to create an IP and MPLS table via the API. - but the enforcement that the table must be created before it is used is still missing, this is so that CSIT can pass. Change-Id: Id124d884ade6cb7da947225200e3bb193454c555 Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-08-15Support proxy ARP on mirrored TAP interfacesNeale Ranns1-4/+16
When VPP has an interface whose address is also applied to a TAP interface on the host, then VPP's TAP interface will be unnumbered to the 'real' interface and do proxy ARP from the host. the curious aspect of this setup is that ARP requests from the host will come from the VPP's own address. Change-Id: Ia238790e1034ba3cd3facdab29387b65a31525f2 Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-08-09VPP-933 VPP crashes when deleting an ARP entryMatthew Smith1-0/+7
When attempting to delete an ARP entry on an interface that hasn't had any ARP entries added yet, VPP was retrieving an array element at an index that was out of bounds and trying to dereference it. Change-Id: Id141d3bfd8378dd8dd63f43b0b4b41461c285a4f Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2017-08-09ARP reply: use interface to build rewrite stringNeale Ranns1-17/+13
Change-Id: I488965e78d0b3291af4c82902098ca666317a22e Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-08-08L2 over MPLSNeale Ranns1-2/+2
[support for VPWS/VPLS] - switch to using dpo_proto_t rather than fib_protocol_t in fib_paths so that we can describe L2 paths - VLIB nodes to handle pop/push of MPLS labels to L2 Change-Id: Id050d06a11fd2c9c1c81ce5a0654e6c5ae6afa6e Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-08-04don't truncate the interface name in 'sh ip arp'Neale Ranns1-1/+1
Change-Id: Ifb17bae98ae1362078889d40e2369d58997bd92c Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2017-07-23Improve L2 Input/Output Feature Infrastructure and UsageJohn Lo1-6/+2
Simplify L2 output feature infra to unify with L2 input feature infra using the newly improved feature bitmap mechanism. Updated all L2 features to use the more efficient infra functions. Change-Id: If8f463826b0af0717129befe92a27ea8cfc40449 Signed-off-by: John Lo <loj@cisco.com>
2017-07-06Send GARP/NA on bonded intf slave up/down if in active-backup modeJohn Lo1-0/+83
If a bonded interface is in active-backup mode and configured with IPv4 and/or IPv6 addresses, on slave interface link up/down, send a GARP packet if configured with an IPv4 address and an unsolcited NA if configured with an IPv6 address. These packets can help with faster route convergence in the next hop router/switch. Change-Id: I68ccb11a4a40cda414704fa08ee0171c952befa2 Signed-off-by: John Lo <loj@cisco.com>