#include <netinet/in.h>
#include <netinet/ip_mroute.h>
+#include <net/if_dl.h>
+
#define SA(p) ((struct sockaddr *)(p))
struct route_cb route_cb;
struct sockaddr *, struct sockaddr *));
static void rtable_init __P((void **));
+__private_extern__ u_long route_generation = 0;
+extern int use_routegenid;
+
+
static void
rtable_init(table)
void **table;
splx(s);
}
ro->ro_rt = rtalloc1(&ro->ro_dst, 1, ignore);
+ if (ro->ro_rt)
+ ro->ro_rt->generation_id = route_generation;
}
/*
{
/*
* find the tree for that address family
+ * Note: in the case of igmp packets, there might not be an rnh
*/
register struct radix_node_head *rnh =
rt_tables[rt_key(rt)->sa_family];
- if (rt == 0 || rnh == 0)
+ if (rt == 0)
panic("rtfree");
/*
* and there is a close function defined, call the close function
*/
rt->rt_refcnt--;
- if(rnh->rnh_close && rt->rt_refcnt == 0) {
+ if(rnh && rnh->rnh_close && rt->rt_refcnt == 0) {
rnh->rnh_close((struct radix_node *)rt, rnh);
}
ifaref(ifa);
rt->rt_ifa = ifa;
rt->rt_ifp = ifa->ifa_ifp;
-#ifdef __APPLE__
- rt->rt_dlt = ifa->ifa_dlt; /* dl_tag */
-#endif
+
/* XXX mtu manipulation will be done in rnh_addaddr -- itojun */
rn = rnh->rnh_addaddr((caddr_t)ndst, (caddr_t)netmask,
int dlen = ROUNDUP(dst->sa_len), glen = ROUNDUP(gate->sa_len);
register struct rtentry *rt = rt0;
struct radix_node_head *rnh = rt_tables[dst->sa_family];
-
+ extern void kdp_set_gateway_mac (void *gatewaymac);
/*
* A host route with the destination equal to the gateway
* will interfere with keeping LLINFO in the routing
rt->rt_gwroute = 0;
return EDQUOT; /* failure */
}
+ /* Tell the kernel debugger about the new default gateway */
+ if ((AF_INET == rt->rt_gateway->sa_family) &&
+ rt->rt_gwroute && rt->rt_gwroute->rt_gateway &&
+ (AF_LINK == rt->rt_gwroute->rt_gateway->sa_family)) {
+ kdp_set_gateway_mac(((struct sockaddr_dl *)rt0->rt_gwroute->rt_gateway)->sdl_data);
+ }
}
/*
* notify any listenning routing agents of the change
*/
rt_newaddrmsg(cmd, ifa, error, nrt);
+ if (use_routegenid)
+ route_generation++;
if (rt->rt_refcnt <= 0) {
rt->rt_refcnt++; /* need a 1->0 transition to free */
rtfree(rt);
* we are adding.
*/
rt->rt_ifp = ifa->ifa_ifp;
-#ifdef __APPLE__
- rt->rt_dlt = ifa->ifa_dlt; /* dl_tag */
-#endif
rt->rt_rmx.rmx_mtu = ifa->ifa_ifp->if_mtu; /*XXX*/
/*
* Now ask the protocol to check if it needs
* notify any listenning routing agents of the change
*/
rt_newaddrmsg(cmd, ifa, error, nrt);
+ if (use_routegenid)
+ route_generation++;
}
return (error);
}