Skip to content

Commit 6a19162

Browse files
jukkarkartben
authored andcommitted
samples: net: Do not setup VLAN if there is no VLAN interfaces
No point trying to initialize VLAN interfaces if the VLAN interface count is zero. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 94361d5 commit 6a19162

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

samples/net/mdns_responder/src/vlan.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ int init_vlan(void)
105105
struct ud user_data;
106106
int ret;
107107

108+
if (CONFIG_NET_VLAN_COUNT == 0) {
109+
LOG_DBG("No VLAN interfaces defined.");
110+
return 0;
111+
}
112+
108113
iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET));
109114
if (!iface) {
110115
LOG_ERR("No ethernet interfaces found.");

samples/net/sockets/echo_client/src/vlan.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ int init_vlan(void)
8585
struct ud ud;
8686
int ret;
8787

88+
if (CONFIG_NET_VLAN_COUNT == 0) {
89+
LOG_DBG("No VLAN interfaces defined.");
90+
return 0;
91+
}
92+
8893
iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET));
8994
if (!iface) {
9095
LOG_ERR("No ethernet interfaces found.");

samples/net/sockets/echo_server/src/vlan.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ int init_vlan(void)
107107
struct ud ud;
108108
int ret;
109109

110+
if (CONFIG_NET_VLAN_COUNT == 0) {
111+
LOG_DBG("No VLAN interfaces defined.");
112+
return 0;
113+
}
114+
110115
memset(&ud, 0, sizeof(ud));
111116

112117
net_if_foreach(iface_cb, &ud);

samples/net/sockets/txtime/src/vlan.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ int init_vlan(void)
9999
struct ud ud;
100100
int ret;
101101

102+
if (CONFIG_NET_VLAN_COUNT == 0) {
103+
LOG_DBG("No VLAN interfaces defined.");
104+
return 0;
105+
}
106+
102107
iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET));
103108
if (!iface) {
104109
LOG_ERR("No ethernet interfaces found.");

0 commit comments

Comments
 (0)