nd6.c (128421) | nd6.c (128636) |
---|---|
1/* $FreeBSD: head/sys/netinet6/nd6.c 128421 2004-04-19 07:48:48Z luigi $ */ | 1/* $FreeBSD: head/sys/netinet6/nd6.c 128636 2004-04-25 09:24:52Z luigi $ */ |
2/* $KAME: nd6.c,v 1.144 2001/05/24 07:44:00 itojun Exp $ */ 3 4/* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 2017 unchanged lines hidden (view full) --- 2027 case IFT_GIF: /* XXX need more cases? */ 2028 return (1); 2029 default: 2030 return (0); 2031 } 2032} 2033 2034int | 2/* $KAME: nd6.c,v 1.144 2001/05/24 07:44:00 itojun Exp $ */ 3 4/* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 2017 unchanged lines hidden (view full) --- 2027 case IFT_GIF: /* XXX need more cases? */ 2028 return (1); 2029 default: 2030 return (0); 2031 } 2032} 2033 2034int |
2035nd6_storelladdr(ifp, rt, m, dst, desten) | 2035nd6_storelladdr(ifp, rt0, m, dst, desten) |
2036 struct ifnet *ifp; | 2036 struct ifnet *ifp; |
2037 struct rtentry *rt; | 2037 struct rtentry *rt0; |
2038 struct mbuf *m; 2039 struct sockaddr *dst; 2040 u_char *desten; 2041{ 2042 int i; 2043 struct sockaddr_dl *sdl; | 2038 struct mbuf *m; 2039 struct sockaddr *dst; 2040 u_char *desten; 2041{ 2042 int i; 2043 struct sockaddr_dl *sdl; |
2044 struct rtentry *rt; |
|
2044 2045 if (m->m_flags & M_MCAST) { 2046 switch (ifp->if_type) { 2047 case IFT_ETHER: 2048 case IFT_FDDI: 2049#ifdef IFT_L2VLAN 2050 case IFT_L2VLAN: 2051#endif --- 16 unchanged lines hidden (view full) --- 2068 *desten = 0; 2069 return (1); 2070 default: 2071 m_freem(m); 2072 return (0); 2073 } 2074 } 2075 | 2045 2046 if (m->m_flags & M_MCAST) { 2047 switch (ifp->if_type) { 2048 case IFT_ETHER: 2049 case IFT_FDDI: 2050#ifdef IFT_L2VLAN 2051 case IFT_L2VLAN: 2052#endif --- 16 unchanged lines hidden (view full) --- 2069 *desten = 0; 2070 return (1); 2071 default: 2072 m_freem(m); 2073 return (0); 2074 } 2075 } 2076 |
2077 i = rt_check(&rt, &rt0, dst); 2078 if (i) { 2079 m_freem(m); 2080 return i; 2081 } 2082 |
|
2076 if (rt == NULL) { 2077 /* this could happen, if we could not allocate memory */ 2078 m_freem(m); | 2083 if (rt == NULL) { 2084 /* this could happen, if we could not allocate memory */ 2085 m_freem(m); |
2079 return (0); | 2086 return (ENOMEM); |
2080 } 2081 if (rt->rt_gateway->sa_family != AF_LINK) { 2082 printf("nd6_storelladdr: something odd happens\n"); 2083 m_freem(m); | 2087 } 2088 if (rt->rt_gateway->sa_family != AF_LINK) { 2089 printf("nd6_storelladdr: something odd happens\n"); 2090 m_freem(m); |
2084 return (0); | 2091 return (EINVAL); |
2085 } 2086 sdl = SDL(rt->rt_gateway); 2087 if (sdl->sdl_alen == 0) { 2088 /* this should be impossible, but we bark here for debugging */ 2089 printf("nd6_storelladdr: sdl_alen == 0\n"); 2090 m_freem(m); | 2092 } 2093 sdl = SDL(rt->rt_gateway); 2094 if (sdl->sdl_alen == 0) { 2095 /* this should be impossible, but we bark here for debugging */ 2096 printf("nd6_storelladdr: sdl_alen == 0\n"); 2097 m_freem(m); |
2091 return (0); | 2098 return (EINVAL); |
2092 } 2093 2094 bcopy(LLADDR(sdl), desten, sdl->sdl_alen); | 2099 } 2100 2101 bcopy(LLADDR(sdl), desten, sdl->sdl_alen); |
2095 return (1); | 2102 return (0); |
2096} 2097 2098static int nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS); 2099static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS); 2100#ifdef SYSCTL_DECL 2101SYSCTL_DECL(_net_inet6_icmp6); 2102#endif 2103SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, --- 117 unchanged lines hidden --- | 2103} 2104 2105static int nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS); 2106static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS); 2107#ifdef SYSCTL_DECL 2108SYSCTL_DECL(_net_inet6_icmp6); 2109#endif 2110SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, --- 117 unchanged lines hidden --- |