if_iso88025subr.c (128615) | if_iso88025subr.c (128636) |
---|---|
1/* 2 * Copyright (c) 1998, Larry Lile 3 * All rights reserved. 4 * 5 * For latest sources and information on this driver, please 6 * go to http://anarchy.stdio.com. 7 * 8 * Questions, comments or suggestions should be directed to --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 1998, Larry Lile 3 * All rights reserved. 4 * 5 * For latest sources and information on this driver, please 6 * go to http://anarchy.stdio.com. 7 * 8 * Questions, comments or suggestions should be directed to --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/net/if_iso88025subr.c 128615 2004-04-24 21:59:41Z luigi $ | 33 * $FreeBSD: head/sys/net/if_iso88025subr.c 128636 2004-04-25 09:24:52Z luigi $ |
34 * 35 */ 36 37/* 38 * 39 * General ISO 802.5 (Token Ring) support routines 40 * 41 */ --- 212 unchanged lines hidden (view full) --- 254#endif 255 256 if (ifp->if_flags & IFF_MONITOR) 257 senderr(ENETDOWN); 258 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) 259 senderr(ENETDOWN); 260 getmicrotime(&ifp->if_lastchange); 261 | 34 * 35 */ 36 37/* 38 * 39 * General ISO 802.5 (Token Ring) support routines 40 * 41 */ --- 212 unchanged lines hidden (view full) --- 254#endif 255 256 if (ifp->if_flags & IFF_MONITOR) 257 senderr(ENETDOWN); 258 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) 259 senderr(ENETDOWN); 260 getmicrotime(&ifp->if_lastchange); 261 |
262 /* Calculate routing info length based on arp table entry */ 263 /* XXX any better way to do this ? */ |
|
262 error = rt_check(&rt, &rt0, dst); 263 if (error) 264 goto bad; 265 | 264 error = rt_check(&rt, &rt0, dst); 265 if (error) 266 goto bad; 267 |
266 /* Calculate routing info length based on arp table entry */ | |
267 if (rt && (sdl = (struct sockaddr_dl *)rt->rt_gateway)) 268 if (SDL_ISO88025(sdl)->trld_rcf != 0) 269 rif_len = TR_RCF_RIFLEN(SDL_ISO88025(sdl)->trld_rcf); 270 271 /* Generate a generic 802.5 header for the packet */ 272 gen_th.ac = TR_AC; 273 gen_th.fc = TR_LLC_FRAME; 274 (void)memcpy((caddr_t)gen_th.iso88025_shost, IFP2AC(ifp)->ac_enaddr, --- 6 unchanged lines hidden (view full) --- 281 (caddr_t)SDL_ISO88025(sdl)->trld_route, 282 rif_len - 2); 283 } 284 } 285 286 switch (dst->sa_family) { 287#ifdef INET 288 case AF_INET: | 268 if (rt && (sdl = (struct sockaddr_dl *)rt->rt_gateway)) 269 if (SDL_ISO88025(sdl)->trld_rcf != 0) 270 rif_len = TR_RCF_RIFLEN(SDL_ISO88025(sdl)->trld_rcf); 271 272 /* Generate a generic 802.5 header for the packet */ 273 gen_th.ac = TR_AC; 274 gen_th.fc = TR_LLC_FRAME; 275 (void)memcpy((caddr_t)gen_th.iso88025_shost, IFP2AC(ifp)->ac_enaddr, --- 6 unchanged lines hidden (view full) --- 282 (caddr_t)SDL_ISO88025(sdl)->trld_route, 283 rif_len - 2); 284 } 285 } 286 287 switch (dst->sa_family) { 288#ifdef INET 289 case AF_INET: |
289 if (!arpresolve(ifp, rt, m, dst, edst)) 290 return (0); /* if not yet resolved */ | 290 error = arpresolve(ifp, rt0, m, dst, edst); 291 if (error) 292 return (error == EWOULDBLOCK ? 0 : error); |
291 snap_type = ETHERTYPE_IP; 292 break; 293 case AF_ARP: 294 { 295 struct arphdr *ah; 296 ah = mtod(m, struct arphdr *); 297 ah->ar_hrd = htons(ARPHRD_IEEE802); 298 --- 16 unchanged lines hidden (view full) --- 315 else 316 bcopy(ar_tha(ah), edst, ISO88025_ADDR_LEN); 317 318 } 319 break; 320#endif /* INET */ 321#ifdef INET6 322 case AF_INET6: | 293 snap_type = ETHERTYPE_IP; 294 break; 295 case AF_ARP: 296 { 297 struct arphdr *ah; 298 ah = mtod(m, struct arphdr *); 299 ah->ar_hrd = htons(ARPHRD_IEEE802); 300 --- 16 unchanged lines hidden (view full) --- 317 else 318 bcopy(ar_tha(ah), edst, ISO88025_ADDR_LEN); 319 320 } 321 break; 322#endif /* INET */ 323#ifdef INET6 324 case AF_INET6: |
323 if (!nd6_storelladdr(ifp, rt, m, dst, (u_char *)edst)) { 324 /* Something bad happened */ 325 return(0); 326 } | 325 error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst); 326 if (error) 327 return (error); |
327 snap_type = ETHERTYPE_IPV6; 328 break; 329#endif /* INET6 */ 330#ifdef IPX 331 case AF_IPX: 332 { 333 u_int8_t *cp; 334 --- 448 unchanged lines hidden --- | 328 snap_type = ETHERTYPE_IPV6; 329 break; 330#endif /* INET6 */ 331#ifdef IPX 332 case AF_IPX: 333 { 334 u_int8_t *cp; 335 --- 448 unchanged lines hidden --- |