ReactOS 0.4.16-dev-306-g647d351
Network interface (NETIF)
Collaboration diagram for Network interface (NETIF):

Modules

 IPv4 address handling
 
 IPv6 address handling
 
 Client data handling
 
 Flags
 
 MIB2 statistics
 

Classes

union  netif_ext_callback_args_t
 

Macros

#define netif_is_up(netif)   (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
 

Typedefs

typedef u16_t netif_nsc_reason_t
 
typedef void(* netif_ext_callback_fn) (struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args)
 

Functions

struct netifnetif_add_noaddr (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
 
struct netifnetif_add (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
 
void netif_remove (struct netif *netif)
 
void netif_set_default (struct netif *netif)
 
void netif_set_up (struct netif *netif)
 
void netif_set_down (struct netif *netif)
 
void netif_set_link_up (struct netif *netif)
 
void netif_set_link_down (struct netif *netif)
 
u8_t netif_name_to_index (const char *name)
 
charnetif_index_to_name (u8_t idx, char *name)
 
struct netifnetif_get_by_index (u8_t idx)
 
struct netifnetif_find (const char *name)
 

Detailed Description

Macro Definition Documentation

◆ netif_is_up

#define netif_is_up (   netif)    (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)

Ask if an interface is up

Definition at line 479 of file netif.h.

Typedef Documentation

◆ netif_ext_callback_fn

Function used for extended netif status callbacks Note: When parsing reason argument, keep in mind that more reasons may be added in the future!

Parameters
netifnetif that is affected by change
reasonchange reason
argsdepends on reason, see reason description

Definition at line 668 of file netif.h.

◆ netif_nsc_reason_t

Extended netif status callback (NSC) reasons flags. May be extended in the future!

Definition at line 586 of file netif.h.

Function Documentation

◆ netif_add()

struct netif * netif_add ( struct netif netif,
void state,
netif_init_fn  init,
netif_input_fn  input 
)

Add a network interface to the list of lwIP netifs.

Parameters
netifa pre-allocated netif structure
ipaddrIP address for the new netif
netmasknetwork mask for the new netif
gwdefault gateway IP address for the new netif
stateopaque data passed to the new netif
initcallback function that initializes the interface
inputcallback function that is called to pass ingress packets up in the protocol layer stack.
It is recommended to use a function that passes the input directly to the stack (netif_input(), NO_SYS=1 mode) or via sending a message to TCPIP thread (tcpip_input(), NO_SYS=0 mode).
These functions use netif flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET to decide whether to forward to ethernet_input() or ip_input(). In other words, the functions only work when the netif driver is implemented correctly!
Most members of struct netif should be be initialized by the netif init function = netif driver (init parameter of this function).
IPv6: Don't forget to call netif_create_ip6_linklocal_address() after setting the MAC address in struct netif.hwaddr (IPv6 requires a link-local address).
Returns
netif, or NULL if failed.

Definition at line 287 of file netif.c.

292{
293#if LWIP_IPV6
294 s8_t i;
295#endif
296
298
299#if LWIP_SINGLE_NETIF
300 if (netif_default != NULL) {
301 LWIP_ASSERT("single netif already set", 0);
302 return NULL;
303 }
304#endif
305
306 LWIP_ERROR("netif_add: invalid netif", netif != NULL, return NULL);
307 LWIP_ERROR("netif_add: No init function given", init != NULL, return NULL);
308
309#if LWIP_IPV4
310 if (ipaddr == NULL) {
311 ipaddr = ip_2_ip4(IP4_ADDR_ANY);
312 }
313 if (netmask == NULL) {
314 netmask = ip_2_ip4(IP4_ADDR_ANY);
315 }
316 if (gw == NULL) {
317 gw = ip_2_ip4(IP4_ADDR_ANY);
318 }
319
320 /* reset new interface configuration state */
321 ip_addr_set_zero_ip4(&netif->ip_addr);
322 ip_addr_set_zero_ip4(&netif->netmask);
323 ip_addr_set_zero_ip4(&netif->gw);
324 netif->output = netif_null_output_ip4;
325#endif /* LWIP_IPV4 */
326#if LWIP_IPV6
327 for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
328 ip_addr_set_zero_ip6(&netif->ip6_addr[i]);
329 netif->ip6_addr_state[i] = IP6_ADDR_INVALID;
330#if LWIP_IPV6_ADDRESS_LIFETIMES
331 netif->ip6_addr_valid_life[i] = IP6_ADDR_LIFE_STATIC;
332 netif->ip6_addr_pref_life[i] = IP6_ADDR_LIFE_STATIC;
333#endif /* LWIP_IPV6_ADDRESS_LIFETIMES */
334 }
335 netif->output_ip6 = netif_null_output_ip6;
336#endif /* LWIP_IPV6 */
337 NETIF_SET_CHECKSUM_CTRL(netif, NETIF_CHECKSUM_ENABLE_ALL);
338 netif->mtu = 0;
339 netif->flags = 0;
340#ifdef netif_get_client_data
341 memset(netif->client_data, 0, sizeof(netif->client_data));
342#endif /* LWIP_NUM_NETIF_CLIENT_DATA */
343#if LWIP_IPV6
344#if LWIP_IPV6_AUTOCONFIG
345 /* IPv6 address autoconfiguration should be enabled by default */
346 netif->ip6_autoconfig_enabled = 1;
347#endif /* LWIP_IPV6_AUTOCONFIG */
348 nd6_restart_netif(netif);
349#endif /* LWIP_IPV6 */
350#if LWIP_NETIF_STATUS_CALLBACK
351 netif->status_callback = NULL;
352#endif /* LWIP_NETIF_STATUS_CALLBACK */
353#if LWIP_NETIF_LINK_CALLBACK
354 netif->link_callback = NULL;
355#endif /* LWIP_NETIF_LINK_CALLBACK */
356#if LWIP_IGMP
357 netif->igmp_mac_filter = NULL;
358#endif /* LWIP_IGMP */
359#if LWIP_IPV6 && LWIP_IPV6_MLD
360 netif->mld_mac_filter = NULL;
361#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
362
363 /* remember netif specific state information data */
364 netif->state = state;
366 netif->input = input;
367
368#if LWIP_ACD
369 netif->acd_list = NULL;
370#endif /* LWIP_ACD */
372#if ENABLE_LOOPBACK
373 netif->loop_first = NULL;
374 netif->loop_last = NULL;
375#if LWIP_LOOPBACK_MAX_PBUFS
376 netif->loop_cnt_current = 0;
377#endif /* LWIP_LOOPBACK_MAX_PBUFS */
378#if LWIP_NETIF_LOOPBACK_MULTITHREADING
379 netif->reschedule_poll = 0;
380#endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */
381#endif /* ENABLE_LOOPBACK */
382
383#if LWIP_IPV4
384 netif_set_addr(netif, ipaddr, netmask, gw);
385#endif /* LWIP_IPV4 */
386
387 /* call user specified initialization function for netif */
388 if (init(netif) != ERR_OK) {
389 return NULL;
390 }
391#if LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES
392 /* Initialize the MTU for IPv6 to the one set by the netif driver.
393 This can be updated later by RA. */
394 netif->mtu6 = netif->mtu;
395#endif /* LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES */
396
397#if !LWIP_SINGLE_NETIF
398 /* Assign a unique netif number in the range [0..254], so that (num+1) can
399 serve as an interface index that fits in a u8_t.
400 We assume that the new netif has not yet been added to the list here.
401 This algorithm is O(n^2), but that should be OK for lwIP.
402 */
403 {
404 struct netif *netif2;
405 int num_netifs;
406 do {
407 if (netif->num == 255) {
408 netif->num = 0;
409 }
410 num_netifs = 0;
411 for (netif2 = netif_list; netif2 != NULL; netif2 = netif2->next) {
412 LWIP_ASSERT("netif already added", netif2 != netif);
413 num_netifs++;
414 LWIP_ASSERT("too many netifs, max. supported number is 255", num_netifs <= 255);
415 if (netif2->num == netif->num) {
416 netif->num++;
417 break;
418 }
419 }
420 } while (netif2 != NULL);
421 }
422 if (netif->num == 254) {
423 netif_num = 0;
424 } else {
425 netif_num = (u8_t)(netif->num + 1);
426 }
427
428 /* add this netif to the list */
431#endif /* "LWIP_SINGLE_NETIF */
433
434#if LWIP_IGMP
435 /* start IGMP processing */
436 if (netif->flags & NETIF_FLAG_IGMP) {
437 igmp_start(netif);
438 }
439#endif /* LWIP_IGMP */
440
441 LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP",
442 netif->name[0], netif->name[1]));
443#if LWIP_IPV4
444 LWIP_DEBUGF(NETIF_DEBUG, (" addr "));
445 ip4_addr_debug_print(NETIF_DEBUG, ipaddr);
446 LWIP_DEBUGF(NETIF_DEBUG, (" netmask "));
447 ip4_addr_debug_print(NETIF_DEBUG, netmask);
448 LWIP_DEBUGF(NETIF_DEBUG, (" gw "));
449 ip4_addr_debug_print(NETIF_DEBUG, gw);
450#endif /* LWIP_IPV4 */
451 LWIP_DEBUGF(NETIF_DEBUG, ("\n"));
452
454
455 return netif;
456}
static int state
Definition: maze.c:121
#define NULL
Definition: types.h:112
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:158
#define LWIP_ERROR(message, expression, handler)
Definition: debug.h:130
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:116
#define mib2_netif_added(ni)
Definition: snmp.h:177
GLenum GLenum GLenum input
Definition: glext.h:9031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint8_t u8_t
Definition: arch.h:125
int8_t s8_t
Definition: arch.h:126
@ ERR_OK
Definition: err.h:55
#define NETIF_DEBUG
Definition: opt.h:3336
#define LWIP_IPV6_NUM_ADDRESSES
Definition: opt.h:2487
#define LWIP_ASSERT_CORE_LOCKED()
Definition: opt.h:227
#define NETIF_FLAG_IGMP
Definition: netif.h:104
#define ip_addr_set_zero_ip6(ipaddr)
Definition: ip_addr.h:366
struct netif * netif_list
Definition: netif.c:113
struct netif * netif_default
Definition: netif.c:115
static u8_t netif_num
Definition: netif.c:118
#define netif_invoke_ext_callback(netif, reason, args)
Definition: netif.h:686
#define NETIF_RESET_HINTS(netif)
Definition: netif.h:570
#define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
Definition: netif.h:415
#define LWIP_NSC_NETIF_ADDED
Definition: netif.h:591
#define memset(x, y, z)
Definition: compat.h:39
Definition: netif.h:269
u8_t flags
Definition: netif.h:354
char name[2]
Definition: netif.h:356
void * state
Definition: netif.h:332
netif_input_fn input
Definition: netif.h:297
u8_t num
Definition: netif.h:359
u16_t mtu
Definition: netif.h:344
struct netif * next
Definition: netif.h:272
static int init
Definition: wintirpc.c:33

Referenced by default_netif_add(), lwip_fuzztest(), main(), netif_add_noaddr(), netif_init(), START_TEST(), TCPRegisterInterface(), and test_netif_add().

◆ netif_add_noaddr()

struct netif * netif_add_noaddr ( struct netif netif,
void state,
netif_init_fn  init,
netif_input_fn  input 
)

Add a network interface to the list of lwIP netifs.

Same as netif_add but without IPv4 addresses

Definition at line 250 of file netif.c.

251{
252 return netif_add(netif,
253#if LWIP_IPV4
254 NULL, NULL, NULL,
255#endif /* LWIP_IPV4*/
256 state, init, input);
257}
#define LWIP_IPV4
Definition: opt.h:734
struct netif * netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
Definition: netif.c:287

Referenced by START_TEST().

◆ netif_find()

struct netif * netif_find ( const char name)

Find a network interface by searching for its name

Parameters
namethe name of the netif (like netif->name) plus concatenated number in ascii representation (e.g. 'en0')

Definition at line 1755 of file netif.c.

1756{
1757 struct netif *netif;
1758 u8_t num;
1759
1761
1762 if (name == NULL) {
1763 return NULL;
1764 }
1765
1766 num = (u8_t)atoi(&name[2]);
1767 if (!num && (name[2] != '0')) {
1768 /* this means atoi has failed */
1769 return NULL;
1770 }
1771
1773 if (num == netif->num &&
1774 name[0] == netif->name[0] &&
1775 name[1] == netif->name[1]) {
1776 LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: found %c%c\n", name[0], name[1]));
1777 return netif;
1778 }
1779 }
1780 LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
1781 return NULL;
1782}
GLuint GLuint num
Definition: glext.h:9618
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define NETIF_FOREACH(netif)
Definition: netif.h:424
Definition: name.c:39

Referenced by netif_name_to_index(), and START_TEST().

◆ netif_get_by_index()

struct netif * netif_get_by_index ( u8_t  idx)

Return the interface for the netif index

Parameters
idxindex of netif to find

Definition at line 1730 of file netif.c.

1731{
1732 struct netif *netif;
1733
1735
1736 if (idx != NETIF_NO_INDEX) {
1738 if (idx == netif_get_index(netif)) {
1739 return netif; /* found! */
1740 }
1741 }
1742 }
1743
1744 return NULL;
1745}
unsigned int idx
Definition: utils.c:41
#define NETIF_NO_INDEX
Definition: netif.h:579
#define netif_get_index(netif)
Definition: netif.h:578

Referenced by netif_index_to_name().

◆ netif_index_to_name()

char * netif_index_to_name ( u8_t  idx,
char name 
)

Return the interface name for the netif matching index or NULL if not found/on error

Parameters
idxthe interface index of the netif
namechar buffer of at least NETIF_NAMESIZE bytes

Definition at line 1710 of file netif.c.

1711{
1712 struct netif *netif = netif_get_by_index(idx);
1713
1714 if (netif != NULL) {
1715 name[0] = netif->name[0];
1716 name[1] = netif->name[1];
1718 return name;
1719 }
1720 return NULL;
1721}
struct netif * netif_get_by_index(u8_t idx)
Definition: netif.c:1730
void lwip_itoa(char *result, size_t bufsize, int number)
Definition: def.c:222
#define netif_index_to_num(index)
Definition: netif.c:117
#define NETIF_NAMESIZE
Definition: netif.h:70

◆ netif_name_to_index()

u8_t netif_name_to_index ( const char name)

Return the interface index for the netif with name or NETIF_NO_INDEX if not found/on error

Parameters
namethe name of the netif

Definition at line 1691 of file netif.c.

1692{
1693 struct netif *netif = netif_find(name);
1694 if (netif != NULL) {
1695 return netif_get_index(netif);
1696 }
1697 /* No name found, return invalid index */
1698 return NETIF_NO_INDEX;
1699}
struct netif * netif_find(const char *name)
Definition: netif.c:1755

◆ netif_remove()

void netif_remove ( struct netif netif)

Remove a network interface from the list of lwIP netifs.

Parameters
netifthe network interface to remove

Definition at line 764 of file netif.c.

765{
766#if LWIP_IPV6
767 int i;
768#endif
769
771
772 if (netif == NULL) {
773 return;
774 }
775
777
778#if LWIP_IPV4
779 if (!ip4_addr_isany_val(*netif_ip4_addr(netif))) {
780 netif_do_ip_addr_changed(netif_ip_addr4(netif), NULL);
781 }
782
783#if LWIP_IGMP
784 /* stop IGMP processing */
785 if (netif->flags & NETIF_FLAG_IGMP) {
786 igmp_stop(netif);
787 }
788#endif /* LWIP_IGMP */
789#endif /* LWIP_IPV4*/
790
791#if LWIP_IPV6
792 for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
793 if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i))) {
794 netif_do_ip_addr_changed(netif_ip_addr6(netif, i), NULL);
795 }
796 }
797#if LWIP_IPV6_MLD
798 /* stop MLD processing */
799 mld6_stop(netif);
800#endif /* LWIP_IPV6_MLD */
801#endif /* LWIP_IPV6 */
802 if (netif_is_up(netif)) {
803 /* set netif down before removing (call callback function) */
805 }
806
808
809 /* this netif is default? */
810 if (netif_default == netif) {
811 /* reset default netif */
813 }
814#if !LWIP_SINGLE_NETIF
815 /* is it the first netif? */
816 if (netif_list == netif) {
818 } else {
819 /* look for netif further down the list */
820 struct netif *tmp_netif;
821 NETIF_FOREACH(tmp_netif) {
822 if (tmp_netif->next == netif) {
823 tmp_netif->next = netif->next;
824 break;
825 }
826 }
827 if (tmp_netif == NULL) {
828 return; /* netif is not on the list */
829 }
830 }
831#endif /* !LWIP_SINGLE_NETIF */
833#if LWIP_NETIF_REMOVE_CALLBACK
834 if (netif->remove_callback) {
835 netif->remove_callback(netif);
836 }
837#endif /* LWIP_NETIF_REMOVE_CALLBACK */
838 LWIP_DEBUGF( NETIF_DEBUG, ("netif_remove: removed netif\n") );
839}
#define mib2_netif_removed(ni)
Definition: snmp.h:178
#define mib2_remove_ip4(ni)
Definition: snmp.h:186
void netif_set_down(struct netif *netif)
Definition: netif.c:949
#define netif_is_up(netif)
Definition: netif.h:479
void netif_set_default(struct netif *netif)
Definition: netif.c:849
static void netif_do_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
Definition: netif.c:459
#define LWIP_NSC_NETIF_REMOVED
Definition: netif.h:593

Referenced by default_netif_remove(), START_TEST(), TCPUnregisterInterface(), and test_netif_remove().

◆ netif_set_default()

void netif_set_default ( struct netif netif)

Set a network interface as the default network interface (used to output all packets for which no specific route is found)

Parameters
netifthe default network interface

Definition at line 849 of file netif.c.

850{
852
853 if (netif == NULL) {
854 /* remove default route */
856 } else {
857 /* install default route */
859 }
861 LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n",
862 netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\''));
863}
#define mib2_add_route_ip4(dflt, ni)
Definition: snmp.h:187
#define mib2_remove_route_ip4(dflt, ni)
Definition: snmp.h:188

Referenced by default_netif_add(), main(), netif_remove(), TCPUpdateInterfaceIPInformation(), and test_netif_add().

◆ netif_set_down()

void netif_set_down ( struct netif netif)

Bring an interface down, disabling any traffic processing.

Definition at line 949 of file netif.c.

950{
952
953 LWIP_ERROR("netif_set_down: invalid netif", netif != NULL, return);
954
955 if (netif->flags & NETIF_FLAG_UP) {
956#if LWIP_NETIF_EXT_STATUS_CALLBACK
957 {
959 args.status_changed.state = 0;
961 }
962#endif
963
966
967#if LWIP_IPV4 && LWIP_ARP
969 etharp_cleanup_netif(netif);
970 }
971#endif /* LWIP_IPV4 && LWIP_ARP */
972
973#if LWIP_IPV6
974 nd6_cleanup_netif(netif);
975#endif /* LWIP_IPV6 */
976
978 }
979}
#define MIB2_COPY_SYSUPTIME_TO(ptrToVal)
Definition: snmp.h:136
#define NETIF_FLAG_ETHARP
Definition: netif.h:97
#define NETIF_FLAG_UP
Definition: netif.h:84
#define NETIF_STATUS_CALLBACK(n)
Definition: netif.c:99
#define LWIP_NSC_STATUS_CHANGED
Definition: netif.h:599
#define netif_clear_flags(netif, clr_flags)
Definition: netif.h:471
#define args
Definition: format.c:66
Definition: match.c:390

Referenced by netif_remove(), START_TEST(), and TCPUpdateInterfaceIPInformation().

◆ netif_set_link_down()

void netif_set_link_down ( struct netif netif)

Called by a driver when its link goes down

Definition at line 1056 of file netif.c.

1057{
1059
1060 LWIP_ERROR("netif_set_link_down: invalid netif", netif != NULL, return);
1061
1064
1065#if LWIP_AUTOIP
1066 autoip_network_changed_link_down(netif);
1067#endif /* LWIP_AUTOIP */
1068
1069#if LWIP_ACD
1070 acd_network_changed_link_down(netif);
1071#endif /* LWIP_ACD */
1072
1073#if LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES
1074 netif->mtu6 = netif->mtu;
1075#endif
1076
1078#if LWIP_NETIF_EXT_STATUS_CALLBACK
1079 {
1081 args.link_changed.state = 0;
1083 }
1084#endif
1085 }
1086}
#define NETIF_FLAG_LINK_UP
Definition: netif.h:93
#define NETIF_LINK_CALLBACK(n)
Definition: netif.c:105
#define LWIP_NSC_LINK_CHANGED
Definition: netif.h:595

Referenced by main(), TCPUpdateInterfaceLinkStatus(), test_tcp_rto_timeout_impl(), test_tcp_rto_timeout_syn_sent_impl(), and test_tcp_zwp_timeout_impl().

◆ netif_set_link_up()

void netif_set_link_up ( struct netif netif)

Called by a driver when its link goes up

Definition at line 1018 of file netif.c.

1019{
1021
1022 LWIP_ERROR("netif_set_link_up: invalid netif", netif != NULL, return);
1023
1024 if (!(netif->flags & NETIF_FLAG_LINK_UP)) {
1026
1027#if LWIP_DHCP
1028 dhcp_network_changed_link_up(netif);
1029#endif /* LWIP_DHCP */
1030
1031#if LWIP_AUTOIP
1032 autoip_network_changed_link_up(netif);
1033#endif /* LWIP_AUTOIP */
1034
1036#if LWIP_IPV6
1037 nd6_restart_netif(netif);
1038#endif /* LWIP_IPV6 */
1039
1041#if LWIP_NETIF_EXT_STATUS_CALLBACK
1042 {
1044 args.link_changed.state = 1;
1046 }
1047#endif
1048 }
1049}
#define NETIF_REPORT_TYPE_IPV4
Definition: netif.c:124
#define NETIF_REPORT_TYPE_IPV6
Definition: netif.c:125
static void netif_issue_reports(struct netif *netif, u8_t report_type)
Definition: netif.c:902
#define netif_set_flags(netif, set_flags)
Definition: netif.h:470

Referenced by lwip_fuzztest(), main(), netif_init(), START_TEST(), and TCPUpdateInterfaceLinkStatus().

◆ netif_set_up()

void netif_set_up ( struct netif netif)

Bring an interface up, available for processing traffic.

Definition at line 871 of file netif.c.

872{
874
875 LWIP_ERROR("netif_set_up: invalid netif", netif != NULL, return);
876
877 if (!(netif->flags & NETIF_FLAG_UP)) {
879
881
883
884#if LWIP_NETIF_EXT_STATUS_CALLBACK
885 {
887 args.status_changed.state = 1;
889 }
890#endif
891
893#if LWIP_IPV6
894 nd6_restart_netif(netif);
895#endif /* LWIP_IPV6 */
896 }
897}

Referenced by default_netif_add(), ip4_teardown(), lwip_fuzztest(), main(), netif_init(), START_TEST(), TCPUpdateInterfaceIPInformation(), and test_netif_add().