X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/43866e378188c25dd1e2208016ab3cbeb086ae6c..55e303ae13a4cf49d70f2294092726f2fffb9ef2:/bsd/net/ether_inet6_pr_module.c diff --git a/bsd/net/ether_inet6_pr_module.c b/bsd/net/ether_inet6_pr_module.c index 65901c1eb..8d6c582a2 100644 --- a/bsd/net/ether_inet6_pr_module.c +++ b/bsd/net/ether_inet6_pr_module.c @@ -257,7 +257,7 @@ inet6_ether_pre_output(ifp, m0, dst_netaddr, route, type, edst, dl_tag ) 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; @@ -266,6 +266,7 @@ inet6_ether_pre_output(ifp, m0, dst_netaddr, route, type, edst, dl_tag ) 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; } @@ -372,19 +373,18 @@ ether_inet6_prmod_ioctl(dl_tag, ifp, command, data) -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; @@ -403,23 +403,21 @@ u_long ether_attach_inet6(struct ifnet *ifp) 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"); }