FreeBSD/sys/net/if_iso88025subr.c
/*
 * Perform common duties while attaching to interface list
 */
Perform common duties while attaching to interface list
Perform common duties while attaching to interface list
void
iso88025_ifattach(struct ifnet *ifp, const u_int8_t *lla, int bpf)
{
    struct ifaddr *ifa;
    struct sockaddr_dl *sdl;
    ifa = NULL;
    ifp->if_type = IFT_ISO88025;
    ifp->if_addrlen = ISO88025_ADDR_LEN;
    ifp->if_hdrlen = ISO88025_HDR_LEN;
    if_attach(ifp);	
    ifp->if_output = iso88025_output;
    ifp->if_input = iso88025_input;
    ifp->if_resolvemulti = iso88025_resolvemulti;
    ifp->if_broadcastaddr = iso88025_broadcastaddr;
    if (ifp->if_baudrate == 0)
        ifp->if_baudrate = TR_16MBPS; 
    if (ifp->if_mtu == 0)
        ifp->if_mtu = ISO88025_DEFAULT_MTU;
    ifa = ifp->if_addr;
    KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
    sdl = (struct sockaddr_dl *)ifa->ifa_addr;
    sdl->sdl_type = IFT_ISO88025;
    sdl->sdl_alen = ifp->if_addrlen;
    bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
    if (bpf)
        bpfattach(ifp, DLT_IEEE802, ISO88025_HDR_LEN);
    return;
}
void iso88025_ifattach ( struct ifnet * ifp , const u_int8_t * lla , int bpf ) { struct ifaddr * ifa ; struct sockaddr_dl * sdl ; ifa = NULL ; ifp -> if_type = IFT_ISO88025 ; ifp -> if_addrlen = ISO88025_ADDR_LEN ; ifp -> if_hdrlen = ISO88025_HDR_LEN ; if_attach ( ifp ) ; ifp -> if_output = iso88025_output ; ifp -> if_input = iso88025_input ; ifp -> if_resolvemulti = iso88025_resolvemulti ; ifp -> if_broadcastaddr = iso88025_broadcastaddr ; if ( ifp -> if_baudrate == 0 ) ifp -> if_baudrate = TR_16MBPS ; if ( ifp -> if_mtu == 0 ) ifp -> if_mtu = ISO88025_DEFAULT_MTU ; ifa = ifp -> if_addr ; KASSERT ( ifa != NULL , ( " \n " , __func__ ) ) ; sdl = ( struct sockaddr_dl * ) ifa -> ifa_addr ; sdl -> sdl_type = IFT_ISO88025 ; sdl -> sdl_alen = ifp -> if_addrlen ; bcopy ( lla , LLADDR ( sdl ) , ifp -> if_addrlen ) ; if ( bpf ) bpfattach ( ifp , DLT_IEEE802 , ISO88025_HDR_LEN ) ; return ; }
Perform common duties while attaching to interface list
Perform common duties while attaching to interface list
/* Must be called before additional assignments */ /* 16Mbit should be a safe default */