802.1D bridge

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

802.1D bridge

SimonW
Can anyone point me to an example using the bridge netif that is in lwip 2.1?
Ideally with 1 leg using either an embedded MAC, or RNDIS over USB host - I
have both legs working independently.

Bonus question: I understand that the 2.1 bridge only works with IPV4. Does
anyone know if IPV6 support is on the horizon, or what is needed to add it?



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: 802.1D bridge

goldsimon@gmx.de


Am 24. Februar 2020 22:45:18 MEZ schrieb SimonW <[hidden email]>:

>Can anyone point me to an example using the bridge netif that is in
>lwip 2.1?
>Ideally with 1 leg using either an embedded MAC, or RNDIS over USB host
>- I
>have both legs working independently.
>
>Bonus question: I understand that the 2.1 bridge only works with IPV4.
>Does
>anyone know if IPV6 support is on the horizon, or what is needed to add
>it?

I'd suggest you should first know what you want. A bridge does not know anything about the upper layer protocols. For the bridge, there is no difference between IP v4 or v6.

I guess what you need is something else...

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: 802.1D bridge

SimonW
THanks for the reply. Motivation for the question is.

From http://www.nongnu.org/lwip/2_1_x/group__bridgeif.html - the only
documentation that I can so far find:

/This file implements an IEEE 802.1D bridge by using a multilayer netif
approach (one hardware-independent netif for the bridge that uses hardware
netifs for its ports). On transmit, the bridge selects the outgoing port(s).
On receive, the port netif calls into the bridge (via its netif->input
function) and the bridge selects the port(s) (and/or its netif->input
function) to pass the received pbuf to.

Usage:

add the port netifs just like you would when using them as dedicated netif
without a bridge
only NETIF_FLAG_ETHARP/NETIF_FLAG_ETHERNET netifs are supported as bridge
ports
add the bridge port netifs without IPv4 addresses (i.e. pass 'NULL, NULL,
NULL')
don't add IPv6 addresses to the port netifs!
set up the bridge configuration in a global variable of type
'bridgeif_initdata_t' that contains
the MAC address of the bridge
some configuration options controlling the memory consumption (maximum
number of ports and FDB entries)
e.g. for a bridge MAC address 00-01-02-03-04-05, 2 bridge ports, 1024 FDB
entries + 16 static MAC entries: bridgeif_initdata_t mybridge_initdata =
BRIDGEIF_INITDATA1(2, 1024, 16, ETH_ADDR(0, 1, 2, 3, 4, 5));
add the bridge netif (with IPv4 config): struct netif bridge_netif;
netif_add(&bridge_netif, &my_ip, &my_netmask, &my_gw, &mybridge_initdata,
bridgeif_init, tcpip_input); NOTE: the passed 'input' function depends on
BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT setting, which controls where the
forwarding is done (netif low level input context vs. tcpip_thread)
set up all ports netifs and the bridge netif
When adding a port netif, NETIF_FLAG_ETHARP flag will be removed from a port
to prevent ETHARP working on that port netif (we only want one IP per bridge
not per port).
When adding a port netif, its input function is changed to call into the
bridge.
/
Makes reference to including IPv4 config and not adding IPv6 addresses. I
could do with fuller documentation - or better still an example.




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: 802.1D bridge

goldsimon@gmx.de


Am 25. Februar 2020 22:38:31 MEZ schrieb SimonW <[hidden email]>:
>[..]
>Makes reference to including IPv4 config and not adding IPv6 addresses.

No, that might be misleading. The netifs get no addresses at all.

>I
>could do with fuller documentation - or better still an example.

This is a standard bridge. Before knowing how to use it in lwip, you should be sure it's the correct thing to use.

Most of the time, you rather need routing, not bridging. A bridge is what you know as a switch in network hardware. It mostly makes sense of all interfaces are of the same type and speed.

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: 802.1D bridge

SimonW
Yup - bridge is what i want. I want to form a number of IoT nodes that are on
a mixture of 10/100 wired ethernet and b/g/n/ac WiFi into a single sub-net.



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: 802.1D bridge

goldsimon@gmx.de
Am 27.02.2020 um 22:05 schrieb SimonW:
> Yup - bridge is what i want. I want to form a number of IoT nodes that are on
> a mixture of 10/100 wired ethernet and b/g/n/ac WiFi into a single sub-net.

OK. So have you just tested it? It's really not that hard. Just
netif_add() your port netifs without IPs and then netif_add() the bridge
netif just like you would add a normal netif (with IPs etc.).

The bridge netif is then the only netif with IP settings, the port
netifs are just used by the bridge netifs for sending and receiving.

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: 802.1D bridge

SimonW
Hi

Making very slow progress on this - it isn't a priority task.

Finally got 2 independent network interfaces working concurrently. I can get
them both to get address via DHCP. I can set either as the default and get
communication. One is using standard 'ethernetif.c' to MCU's internal MAC.
The other is using 'usb_ethernetif_freertos.c' - not sure if this is part of
the standard LwIP package, or if it is an NXP addition.

I've created a bridge using 'netif_add'. This appears to be successful. I
now have 2 questions:

1. Using 'bridgeif_add_port' for both the interfaces fails. This is because
the add is only supported if NETIF_FLAG_ETHARP /AND/ NETIF_FLAG_ETHERNET are
set. Although both interfaces are Ethernet, only NETIF_FLAG_ETHARP is set.
I've searched the code and can't find anywhere that NETIF_FLAG_ETHERNET is
set - ever. Do you know why?

2. If I force NETIF_FLAG_ETHERNET on for both ports, they are successfully
added. If I then ask the bridge to get an address by DHCP, it never does. I
can see DHCP Discover packets coming out of both ports with the MAC address
assigned to the bridge, but the response doesn't make it back. Am I missing
something obvious?




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users