Lines Matching +full:promiscuous +full:- +full:mode

5  * SPDX-License-Identifier: Apache-2.0
36 k_mutex_lock(&ctx->lock, K_FOREVER); in lock_bridge()
41 k_mutex_unlock(&ctx->lock); in unlock_bridge()
64 ctx = net_if_get_device(iface)->data; in iface_cb()
66 br_user_data->cb(ctx, br_user_data->user_data); in iface_cb()
91 struct eth_bridge_iface_context *ctx = net_if_get_device(br)->data; in eth_bridge_iface_add()
99 return -EINVAL; in eth_bridge_iface_add()
104 return -EINVAL; in eth_bridge_iface_add()
109 if (eth_ctx->bridge == br) { in eth_bridge_iface_add()
114 ARRAY_FOR_EACH(ctx->eth_iface, i) { in eth_bridge_iface_add()
115 if (!found && ctx->eth_iface[i] == NULL) { in eth_bridge_iface_add()
116 ctx->eth_iface[i] = iface; in eth_bridge_iface_add()
117 eth_ctx->bridge = br; in eth_bridge_iface_add()
122 if (ctx->eth_iface[i] != NULL) { in eth_bridge_iface_add()
123 struct ethernet_context *tmp = net_if_l2_data(ctx->eth_iface[i]); in eth_bridge_iface_add()
125 if (tmp->bridge == br) { in eth_bridge_iface_add()
134 return -ENOMEM; in eth_bridge_iface_add()
138 if (ret != 0 && ret != -EALREADY) { in eth_bridge_iface_add()
139 /* Ignore any errors when using native-sim driver, in eth_bridge_iface_add()
140 * we do not need host promiscuous working when testing in eth_bridge_iface_add()
141 * bridging using native-sim. in eth_bridge_iface_add()
144 NET_DBG("iface %d promiscuous mode failed: %d", in eth_bridge_iface_add()
155 ctx->is_setup = true; in eth_bridge_iface_add()
157 NET_INFO("Bridge %d is %ssetup", net_if_get_by_iface(eth_ctx->bridge), ""); in eth_bridge_iface_add()
159 net_virtual_set_name(ctx->iface, "<config ok>"); in eth_bridge_iface_add()
162 ctx->count = count; in eth_bridge_iface_add()
169 struct eth_bridge_iface_context *ctx = net_if_get_device(br)->data; in eth_bridge_iface_remove()
175 return -EINVAL; in eth_bridge_iface_remove()
180 return -EINVAL; in eth_bridge_iface_remove()
185 ARRAY_FOR_EACH(ctx->eth_iface, i) { in eth_bridge_iface_remove()
186 if (!found && ctx->eth_iface[i] == iface) { in eth_bridge_iface_remove()
187 ctx->eth_iface[i] = NULL; in eth_bridge_iface_remove()
188 eth_ctx->bridge = NULL; in eth_bridge_iface_remove()
193 if (ctx->eth_iface[i] != NULL) { in eth_bridge_iface_remove()
194 struct ethernet_context *tmp = net_if_l2_data(ctx->eth_iface[i]); in eth_bridge_iface_remove()
196 if (tmp->bridge == br) { in eth_bridge_iface_remove()
208 ctx->is_setup = false; in eth_bridge_iface_remove()
212 net_virtual_set_name(ctx->iface, "<no config>"); in eth_bridge_iface_remove()
215 ctx->count = count; in eth_bridge_iface_remove()
222 if (addr->addr[0] == 0x01 && in is_link_local_addr()
223 addr->addr[1] == 0x80 && in is_link_local_addr()
224 addr->addr[2] == 0xc2 && in is_link_local_addr()
225 addr->addr[3] == 0x00 && in is_link_local_addr()
226 addr->addr[4] == 0x00 && in is_link_local_addr()
227 (addr->addr[5] & 0x0f) == 0x00) { in is_link_local_addr()
241 struct eth_bridge_iface_context *ctx = net_if_get_device(iface)->data; in bridge_iface_init()
245 if (ctx->is_init) { in bridge_iface_init()
249 k_mutex_init(&ctx->lock); in bridge_iface_init()
251 ctx->iface = iface; in bridge_iface_init()
260 snprintk(name, sizeof(name), "bridge%d", ctx->id); in bridge_iface_init()
269 random_linkaddr(vctx->lladdr.addr, sizeof(vctx->lladdr.addr)); in bridge_iface_init()
271 vctx->lladdr.len = sizeof(vctx->lladdr.addr); in bridge_iface_init()
272 vctx->lladdr.type = NET_LINK_UNKNOWN; in bridge_iface_init()
274 net_if_set_link_addr(iface, vctx->lladdr.addr, in bridge_iface_init()
275 vctx->lladdr.len, vctx->lladdr.type); in bridge_iface_init()
277 ctx->is_init = true; in bridge_iface_init()
278 ctx->is_setup = false; in bridge_iface_init()
290 struct eth_bridge_iface_context *ctx = dev->data; in bridge_iface_start()
292 if (!ctx->is_setup) { in bridge_iface_start()
294 net_if_get_by_iface(ctx->iface)); in bridge_iface_start()
295 return -ENOENT; in bridge_iface_start()
298 if (ctx->status) { in bridge_iface_start()
299 return -EALREADY; in bridge_iface_start()
302 ctx->status = true; in bridge_iface_start()
304 NET_DBG("Starting iface %d", net_if_get_by_iface(ctx->iface)); in bridge_iface_start()
306 NET_INFO("Bridge %d is %sactive", net_if_get_by_iface(ctx->iface), ""); in bridge_iface_start()
308 net_virtual_set_name(ctx->iface, "<enabled>"); in bridge_iface_start()
315 struct eth_bridge_iface_context *ctx = dev->data; in bridge_iface_stop()
317 if (!ctx->status) { in bridge_iface_stop()
318 return -EALREADY; in bridge_iface_stop()
321 ctx->status = false; in bridge_iface_stop()
323 NET_DBG("Stopping iface %d", net_if_get_by_iface(ctx->iface)); in bridge_iface_stop()
325 NET_INFO("Bridge %d is %sactive", net_if_get_by_iface(ctx->iface), "not "); in bridge_iface_stop()
327 if (ctx->is_setup) { in bridge_iface_stop()
328 net_virtual_set_name(ctx->iface, "<disabled>"); in bridge_iface_stop()
330 net_virtual_set_name(ctx->iface, "<no config>"); in bridge_iface_stop()
340 struct eth_bridge_iface_context *ctx = net_if_get_device(iface)->data; in bridge_iface_process()
345 /* Drop all link-local packets for now. */ in bridge_iface_process()
358 count = ctx->count; in bridge_iface_process()
363 ARRAY_FOR_EACH(ctx->eth_iface, i) { in bridge_iface_process()
364 if (ctx->eth_iface[i] != NULL && ctx->eth_iface[i] != orig_iface) { in bridge_iface_process()
366 if (!net_if_flag_is_set(ctx->eth_iface[i], NET_IF_UP)) { in bridge_iface_process()
386 net_pkt_set_iface(send_pkt, ctx->eth_iface[i]); in bridge_iface_process()
387 net_if_queue_tx(ctx->eth_iface[i], send_pkt); in bridge_iface_process()
391 net_if_get_by_iface(ctx->eth_iface[i]), in bridge_iface_process()
392 send_pkt, (int)atomic_get(&send_pkt->atomic_ref)); in bridge_iface_process()
441 * So we return -ENOTSUP here so that the attachment fails if it is tried.
449 return -ENOTSUP; in bridge_iface_attach()