[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Bridge Port with DHCP
From: |
sjtu |
Subject: |
[lwip-users] Bridge Port with DHCP |
Date: |
Mon, 13 Dec 2021 14:36:49 +0800 |
Hi
I am trying to use lwip bridge to replace vswitch which is implemented by
myself.
And I follow the usage here
http://www.nongnu.org/lwip/2_1_x/group__bridgeif.html to use lwip bridge.
Now I just add one port to the bridge, I use port_netif->input() func to submit
the data.
When I use DHCP to get an IP, the network frame will be forwarded to
bridge_netif->input func which is reasonable. But when the `tcpip_thread` calls
`msg->msg.inp.input_fn(msg->msg.inp.p, msg->msg.inp.netif)`, the netif inside
is `bridge_netif`.
The func call chain is like `ethernet_input` -> `ip4_input`
In `ip4_input`, `ip_data.current_input_netif` will be set to bridge_netif,
which will be used in `dhcp_recv`.
`dhcp_recv` will call `ip_current_input_netif` to get a netif, and read dhcp
data from it.
This is the key problem, when I calls `ip4_input`, the
`ip_data.current_input_netif` will be set to `bridge_netif`, so I cannot use
port_netif’s dhcp data to get IP.
Now I can assign IP to the bridge_netif, not the port_netif.
How can I assign IP per port by DHCP?
- [lwip-users] Bridge Port with DHCP,
sjtu <=