mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-16 08:43:17 +00:00
Added source comments.
This commit is contained in:
parent
d47ef79c04
commit
dbdd0f520f
@ -60,24 +60,29 @@ netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask,
|
|||||||
{
|
{
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
static int netifnum = 0;
|
static int netifnum = 0;
|
||||||
|
|
||||||
|
/* allocate netif structure */
|
||||||
netif = mem_malloc(sizeof(struct netif));
|
netif = mem_malloc(sizeof(struct netif));
|
||||||
|
|
||||||
if(netif == NULL) {
|
if(netif == NULL) {
|
||||||
|
DEBUGF(NETIF_DEBUG, ("netif_add(): out of memory for netif\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* remember netif specific state information data */
|
||||||
netif->state = state;
|
netif->state = state;
|
||||||
netif->num = netifnum++;
|
netif->num = netifnum++;
|
||||||
netif->input = input;
|
netif->input = input;
|
||||||
|
|
||||||
netif_set_addr(netif, ipaddr, netmask, gw);
|
netif_set_addr(netif, ipaddr, netmask, gw);
|
||||||
|
|
||||||
|
/* call user specified initialization function for netif */
|
||||||
if (init(netif) != ERR_OK) {
|
if (init(netif) != ERR_OK) {
|
||||||
mem_free(netif);
|
mem_free(netif);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* add this netif to the list */
|
||||||
netif->next = netif_list;
|
netif->next = netif_list;
|
||||||
netif_list = netif;
|
netif_list = netif;
|
||||||
#if NETIF_DEBUG
|
#if NETIF_DEBUG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user