Skip to content

Commit 25301ac

Browse files
jukkarnashif
authored andcommitted
net: virtual: Pass status to caller when starting/stopping interface
When virtual interface is being started or stopped so when the interface is brought up or down, check the return code and pass it to net_if_up() or net_if_down() calls. This helps to avoid printing success status even if the interface up/down failed at the virtual interface level. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 5355920 commit 25301ac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

subsys/net/l2/virtual/virtual.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ static int virtual_enable(struct net_if *iface, bool state)
110110
{
111111
const struct virtual_interface_api *virt;
112112
struct virtual_interface_context *ctx;
113+
int ret = 0;
113114

114115
virt = net_if_get_device(iface)->api;
115116
if (!virt) {
@@ -144,17 +145,17 @@ static int virtual_enable(struct net_if *iface, bool state)
144145
}
145146

146147
if (virt->start) {
147-
virt->start(net_if_get_device(iface));
148+
ret = virt->start(net_if_get_device(iface));
148149
}
149150

150-
return 0;
151+
return ret;
151152
}
152153

153154
if (virt->stop) {
154-
virt->stop(net_if_get_device(iface));
155+
ret = virt->stop(net_if_get_device(iface));
155156
}
156157

157-
return 0;
158+
return ret;
158159
}
159160

160161
enum net_l2_flags virtual_flags(struct net_if *iface)

0 commit comments

Comments
 (0)