/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <net/if_vlan_var.h>
#endif /* NVLAN > 0 */
-/* Local function declerations */
-int ether_attach_inet6(struct ifnet *ifp, u_long protocol_family);
-int ether_detach_inet6(struct ifnet *ifp, u_long protocol_family);
+#include <net/ether_if_module.h>
/*
* Process a received Ethernet packet;
* the ether header, which is provided separately.
*/
static errno_t
-inet6_ether_input(
+ether_inet6_input(
__unused ifnet_t ifp,
protocol_family_t protocol,
mbuf_t packet,
__unused char *header)
{
- proto_input(protocol, packet);
- return 0;
+ errno_t error;
+
+ if ((error = proto_input(protocol, packet)))
+ m_freem(packet);
+ return error;
}
static errno_t
-inet6_ether_pre_output(
+ether_inet6_pre_output(
ifnet_t ifp,
__unused protocol_family_t protocol_family,
mbuf_t *m0,
struct ifreq *ifr = (struct ifreq *) data;
int error = 0;
- switch (command) {
- case SIOCSIFADDR:
- if ((ifp->if_flags & IFF_RUNNING) == 0) {
- ifnet_set_flags(ifp, IFF_UP, IFF_UP);
- dlil_ioctl(0, ifp, SIOCSIFFLAGS, (caddr_t) 0);
- }
+ switch (command) {
+ case SIOCSIFADDR:
+ if ((ifp->if_flags & IFF_RUNNING) == 0) {
+ ifnet_set_flags(ifp, IFF_UP, IFF_UP);
+ ifnet_ioctl(ifp, 0, SIOCSIFFLAGS, NULL);
+ }
+ break;
- break;
-
- case SIOCGIFADDR:
+ case SIOCGIFADDR:
ifnet_lladdr_copy_bytes(ifp, ifr->ifr_addr.sa_data, ETHER_ADDR_LEN);
- break;
-
- case SIOCSIFMTU:
- /*
- * IOKit IONetworkFamily will set the right MTU according to the driver
- */
-
- return (0);
+ break;
default:
- return EOPNOTSUPP;
+ error = EOPNOTSUPP;
+ break;
}
-
return (error);
}
-int
+errno_t
ether_attach_inet6(
struct ifnet *ifp,
- __unused u_long protocol_family)
+ __unused protocol_family_t protocol_family)
{
struct ifnet_attach_proto_param proto;
struct ifnet_demux_desc demux[1];
demux[0].datalen = sizeof(en_6native);
proto.demux_list = demux;
proto.demux_count = 1;
- proto.input = inet6_ether_input;
- proto.pre_output = inet6_ether_pre_output;
+ proto.input = ether_inet6_input;
+ proto.pre_output = ether_inet6_pre_output;
proto.ioctl = ether_inet6_prmod_ioctl;
proto.resolve = ether_inet6_resolve_multi;
error = ifnet_attach_protocol(ifp, protocol_family, &proto);
return error;
}
-int
+void
ether_detach_inet6(
struct ifnet *ifp,
- u_long protocol_family)
+ protocol_family_t protocol_family)
{
- errno_t error;
+ errno_t error;
error = ifnet_detach_protocol(ifp, protocol_family);
if (error && error != ENOENT) {
printf("WARNING: ether_detach_inet6 can't detach ipv6 from %s%d\n",
ifp->if_name, ifp->if_unit);
}
-
- return error;
}