diff --git a/src/sys/include/net/netif.h b/src/sys/include/net/netif.h index baf9898..368bfff 100644 --- a/src/sys/include/net/netif.h +++ b/src/sys/include/net/netif.h @@ -67,8 +67,7 @@ struct route_cache *route_cache_add(struct ip_addr *ipaddr, struct ip_addr *netmask, - struct ip_addr *gw, - void (* init)(struct route_cache *route_cache)); + struct ip_addr *gw); struct netif { struct netif *next; diff --git a/src/sys/net/core/ip.c b/src/sys/net/core/ip.c index e765408..81e9a77 100644 --- a/src/sys/net/core/ip.c +++ b/src/sys/net/core/ip.c @@ -148,10 +148,18 @@ for(route_cache = route_cache_list; route_cache != NULL; route_cache = route_cache->next) { if(ip_addr_maskcmp(dest, &(route_cache->ip_addr), &(route_cache->netmask))) { + kprintf ("RouteNG: Cache Hit\n"); return route_cache; } } + /* Garbage injection: No real RouteNG intelligence, just building entries + to test the cache system. */ + + kprintf ("RouteNG: Adding Cache Entry\n"); + IP4_ADDR(&netmask, 255,255,255,0); + route_cache_add(dest, &netmask, &(netif_default->gw)); + return netif_default; } #if IP_FORWARD diff --git a/src/sys/net/core/netif.c b/src/sys/net/core/netif.c index e1f1e9a..7a1e892 100644 --- a/src/sys/net/core/netif.c +++ b/src/sys/net/core/netif.c @@ -149,8 +149,7 @@ /* Add to the Route Cache */ struct route_cache * route_cache_add(struct ip_addr *ipaddr, struct ip_addr *netmask, - struct ip_addr *gw, - void (* init)(struct route_cache *route_cache)) + struct ip_addr *gw) { route_cache_t *route_cache; static int route_cache_num = 0;