if (!nd6_storelladdr(&ac->ac_if, rt, m, dst_netaddr, (u_char *)edst)) {
/* this must be impossible, so we bark */
printf("nd6_storelladdr failed\n");
- return(0);
+ return(EADDRNOTAVAIL); /* dlil_output will free the mbuf */
}
*(u_short *)type = htons(ETHERTYPE_IPV6);
break;
printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit,
dst_netaddr->sa_family);
+ /* dlil_output will free the mbuf */
return EAFNOSUPPORT;
}
-u_long ether_attach_inet6(struct ifnet *ifp)
+int ether_attach_inet6(struct ifnet *ifp, u_long *dl_tag)
{
struct dlil_proto_reg_str reg;
struct dlil_demux_desc desc;
- u_long ip_dl_tag=0;
u_short en_6native=ETHERTYPE_IPV6;
int stat;
int i;
- stat = dlil_find_dltag(ifp->if_family, ifp->if_unit, PF_INET6, &ip_dl_tag);
+ stat = dlil_find_dltag(ifp->if_family, ifp->if_unit, PF_INET6, dl_tag);
if (stat == 0)
- return ip_dl_tag;
+ return stat;
TAILQ_INIT(®.demux_desc_head);
desc.type = DLIL_DESC_RAW;
reg.default_proto = 0;
reg.protocol_family = PF_INET6;
- stat = dlil_attach_protocol(®, &ip_dl_tag);
+ stat = dlil_attach_protocol(®, dl_tag);
if (stat) {
printf("WARNING: ether_attach_inet6 can't attach ip to interface\n");
- return stat;
}
- return ip_dl_tag;
+ return stat;
}
-int ether_detach_inet6(struct ifnet *ifp)
+int ether_detach_inet6(struct ifnet *ifp, u_long dl_tag)
{
- u_long ip_dl_tag = 0;
int stat;
- stat = dlil_find_dltag(ifp->if_family, ifp->if_unit, PF_INET6, &ip_dl_tag);
+ stat = dlil_find_dltag(ifp->if_family, ifp->if_unit, PF_INET6, &dl_tag);
if (stat == 0) {
- stat = dlil_detach_protocol(ip_dl_tag);
+ stat = dlil_detach_protocol(dl_tag);
if (stat) {
printf("WARNING: ether_detach_inet6 can't detach ip6 from interface\n");
}