/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* bridged - bridging control daemon. This module provides DLPI-specific
* functions for interface to libdlpi.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <syslog.h>
#include <stropts.h>
#include <stp_in.h>
#include <net/if_types.h>
#include <sys/ethernet.h>
#include "global.h"
ENF_PUSHWORD | 0, /* check for 1:80:c2:0:0:0 dest. */
#ifdef _BIG_ENDIAN
0x0180,
#else
0x8001,
#endif
ENF_PUSHWORD | 1,
#ifdef _BIG_ENDIAN
0xC200,
#else
0x00C2,
#endif
ENF_PUSHWORD | 2,
0x4242,
};
/*
* Because we're called by dlpi_recv(), we're called with the engine lock held.
*/
/*ARGSUSED*/
static void
{
int rc;
case DL_NOTE_SPEED:
/* libdlpi gives us Kbps, and we want Mbps */
break;
break;
case DL_NOTE_PHYS_ADDR:
break;
case DL_NOTE_LINK_DOWN:
if (!port->phys_status)
break;
break;
break;
case DL_NOTE_LINK_UP:
if (port->phys_status)
break;
port->sdu_failed) {
break;
}
/*
* If we're not running STP, and the link state has just come
* up, then clear out any protection shutdown state, and allow
* us to forward again.
*/
}
break;
}
}
{
int rc;
/*
* We use DLPI 'raw' mode so that we get access to the received
* Ethernet 802 length field. libdlpi otherwise eats this value. Note
* that 'raw' mode support is required in order to use snoop, so it's
* expected to be common, even if it's not documented.
*/
if (rc != DLPI_SUCCESS) {
dlpi_strerror(rc));
return (B_FALSE);
}
/*
* Now that the driver is open, we can get at least the initial value
* of the interface speed. We need to do this before establishing the
* notify callback, so that it can update us later.
*/
/*
* Save off the libdlpi port name, as it's dynamically allocated, and
* the name we're passed is not.
*/
/*
* We can't bind SAP 0 or enable multicast on an etherstub. It's ok,
* though, because there's no real hardware involved.
*/
if (class != DATALINK_CLASS_ETHERSTUB) {
dlpi_strerror(rc));
return (B_FALSE);
}
sizeof (bridge_group_address))) != DLPI_SUCCESS) {
return (B_FALSE);
}
}
DLPI_SUCCESS) {
dlpi_strerror(rc));
}
if (rc != DLPI_SUCCESS) {
return (B_FALSE);
}
if (alen != ETHERADDRL) {
return (B_FALSE);
}
if (class != DATALINK_CLASS_ETHERSTUB) {
portname);
pf.Pf_Priority = 0;
sizeof (*bpdu_filter);
sizeof (bpdu_filter));
"pfil ioctl failed on %s: %m", portname);
} else {
portname);
}
}
if (debugging) {
}
return (B_TRUE);
}