55 |
netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask, |
netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask, |
56 |
struct ip_addr *gw, |
struct ip_addr *gw, |
57 |
void *state, |
void *state, |
58 |
void (* init)(struct netif *netif), |
err_t (* init)(struct netif *netif), |
59 |
err_t (* input)(struct pbuf *p, struct netif *netif)) |
err_t (* input)(struct pbuf *p, struct netif *netif)) |
60 |
{ |
{ |
61 |
struct netif *netif; |
struct netif *netif; |
74 |
ip_addr_set(&(netif->netmask), netmask); |
ip_addr_set(&(netif->netmask), netmask); |
75 |
ip_addr_set(&(netif->gw), gw); |
ip_addr_set(&(netif->gw), gw); |
76 |
|
|
77 |
init(netif); |
if (init(netif) != ERR_OK) { |
78 |
|
mem_free(netif); |
79 |
|
return NULL; |
80 |
|
} |
81 |
|
|
82 |
netif->next = netif_list; |
netif->next = netif_list; |
83 |
netif_list = netif; |
netif_list = netif; |
84 |
#if NETIF_DEBUG |
#if NETIF_DEBUG |