2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Bridge Administration Library. 2N/A * This library is used by administration tools such as dladm(1M) to configure 2N/A * bridges, and by the bridge daemon to retrieve configuration information. 2N/A/* Bridge property-group */ 2N/A/* Public bridge properties */ 2N/A/* Private bridge properties */ 2N/A/* Bridge properties to store during "down" */ 2N/A/* TRILL property-group and property */ 2N/A /* If the limit is unknown, then use an arbitrary value */ 2N/A * Start up SCF and bind the requested instance alone. 2N/A * Start up SCF and an exact FMRI. This is used for creating new instances and 2N/A * This function sets up a composed view of the configuration information for 2N/A * the specified instance. When this is done, the get_property() function 2N/A * should be able to return individual parameters. 2N/A /* Knock on the door */ 2N/A /* The door_call function doesn't restart, so take care of that */ 2N/A /* If we get an unexpected response, then return an error */ 2N/A /* The daemon returns a single int for errors */ 2N/A /* LINTED: pointer alignment */ 2N/A /* LINTED: pointer alignment */ 2N/A /* Terminated daemon returns with zero data */ 2N/A /* Revoked door is the same as no door at all */ 2N/A * Wrapper function for making per-port calls. 2N/A * SMF doesn't give any synchronous behavior or dependency 2N/A * ordering for refresh operations, so we have to invent our 2N/A * own mechanism here. Get the refresh counter from the 2N/A * daemon, and wait for it to change. It's not pretty, but 2N/A * Look up bridge property values from SCF and return them. 2N/A /* It's ok for this to be missing; it's installed separately */ 2N/A * Retrieve special non-settable and undocumented parameters. 2N/A * Set private bridge parameters. 2N/A * Create the datalink entry for the bridge. Note that all of 2N/A * the real configuration information is in SMF. 2N/A/* Convert bridge protection option string to dladm_bridge_prot_t */ 2N/A/* Convert bridge protection option from dladm_bridge_prot_t to string */ 2N/A * Shut down a possibly-running service instance. If this is a permanent 2N/A * change, then delete it from the system. 2N/A /* If we can disable, then wait for it to happen. */ 2N/A * To enable TRILL, we must create a new instance of the TRILL service, then 2N/A * add proper dependencies to it, and finally mark it as enabled. The 2N/A * dependencies will keep it from going on-line until the bridge is running. 2N/A * This check is here in case the user has installed and then removed 2N/A * the package. SMF should remove the manifest, but currently does 2N/A * If we created an instance and then failed, then remove the instance 2N/A * Create a new bridge or modify an existing one. Update the SMF configuration 2N/A * Input timer values are in IEEE scaled (* 256) format. 2N/A * This check is here in case the user has installed and then 2N/A * removed the package. SMF should remove the manifest, but 2N/A * currently does not. 2N/A /* set up for a series of scf calls */ 2N/A * If we're modifying an existing and running bridge, then tell the 2N/A * daemon to update the requested values. 2N/A * If we created an instance and then failed, then remove the instance 2N/A * Remove the bridge linkid if we've allocated one in this function but 2N/A * we've failed to set up the SMF properties. 2N/A * Set a link as a member of a bridge, or remove bridge membership. If the 2N/A * DLADM_OPT_CREATE flag is set, then we assume that the daemon isn't running. 2N/A * In all other cases, we must tell the daemon to add or delete the link in 2N/A * order to stay in sync. 2N/A * Don't allow a link to be reassigned directly from one bridge 2N/A * to another. It must be removed first. 2N/A * Get the name of the bridge of which the given linkid is a member. 2N/A * Delete a previously created bridge. 2N/A /* Get the datalink ID for this bridge */ 2N/A * See whether there are any persistent links using this 2N/A * bridge. If so, we fail the operation. 2N/A /* Disable or remove the SMF instance */ 2N/A * Delete ACTIVE linkprop now that daemon is gone. 2N/A/* Check if given name is valid for bridges */ 2N/A * The bridge name cannot start or end with a digit. 2N/A * The legal characters within a bridge name are: 2N/A * alphanumeric (a-z, A-Z, 0-9), and the underscore ('_'). 2N/A * Convert a bridge-related observability node name back into the name of the 2N/A * bridge. Returns B_FALSE without making changes if the input name is not in 2N/A * Get bridge property values from the running daemon and return them in a 2N/A * Get bridge state from the running daemon and return in structure borrowed 2N/A/* Returns list of ports (datalink_id_t values) assigned to a bridge instance */ 2N/A * Returns an array of datalink_id_t values for all the ports 2N/A * part of the bridge instance. First entry in the array is the 2N/A/* Retrieve Bridge port configuration values */ 2N/A/* Retreive Bridge port status (disabled, bad SDU etc.) */ 2N/A/* Retrieve Bridge forwarding status of the given link */ 2N/A/* Retrieve Bridge forwarding table entries */ 2N/A/* Retrieve list of TRILL nicknames from the TRILL module */ 2N/A/* Retrieve any stored TRILL nickname from TRILL SMF service */ 2N/A/* Stores TRILL nickname in SMF configuraiton for the TRILL service */ 2N/A * Get the bridge name from the given linkid. Replace the final 0 in the link 2N/A * Bring up a persistent bridge. The bridge's SMF instance is created and 2N/A * enabled and its properties from datalink-<profile>.conf are applied to that 2N/A * SMF instance. This allows the bridge to be profile-specific. 2N/A * Read back all the properties written out in i_dladm_bridge_down() 2N/A * Add the SMF instance for this bridge. dladm_configure_bridge() 2N/A * will add the instance only if DLADM_OPT_CREATE flag is passed, but 2N/A * passing that flag also tries to create a new linkid. Since we 2N/A * don't want that, we'll create the instance first and then configure 2N/A /* Configure bridge, set TRILL nickname and private bridge parameters */ 2N/A /* Finally, enable the bridge */ 2N/A * Bring up a previously created persistent bridge or all persistent bridges. 2N/A * Bring down an active bridge. The bridge's configuration is stored in 2N/A * datalink-<profile>.conf from the SMF instance, which is then removed. This 2N/A * allows bridges to be profile-specific. 2N/A * Retrieve the bridge properties from the bridge and trill SMF 2N/A * services and write the protection and the values of these properties 2N/A /* The following are private bridge parameters */ 2N/A /* The following is the TRILL nickname */ 2N/A * Disable and remove the instances of this bridge from 2N/A * Bring down one bridge or all active bridges. Persistent configuration and 2N/A * linkid mapping in dlmgmtd is not removed. Downed bridge(s) can be brought 2N/A * up with dladm_bridge_up().