Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules: introduce LLDP support #25

Closed
wants to merge 1 commit into from

Conversation

christophefontaine
Copy link
Collaborator

Interfaces must accept multicast frames:
grcli set interface port <port0> allmulti on
LLDP is configured globally

grcli set lldp [rx|tx|both|off]
grcli set lldp ttl [10..600]
# grcli show lldp config
lldp: rx: on tx: on ttl: 60

# grcli show lldp neighbors
LLDP Neighbors: 2
Age  TTL  ifname        Sys name
  4 120s   dpdk-p0      crs317
  6 120s   p1   compute04.mgmt.foobar.space

@david-marchand
Copy link
Member

Interfaces must accept multicast frames: grcli set interface port <port0> allmulti on LLDP is configured globally

I would prefer a list of interfaces with LLDP enabled is set in the lldp module.

This way, the LLDP module request this allmulti stuff (better from a user pov).
And I would filter unwanted LLDP frames if received from an iface not in the list.

modules/lldp/cli.c Outdated Show resolved Hide resolved
modules/lldp/cli.c Outdated Show resolved Hide resolved
modules/lldp/sink.c Outdated Show resolved Hide resolved
modules/lldp/announce.c Outdated Show resolved Hide resolved
modules/lldp/sink.c Outdated Show resolved Hide resolved
modules/lldp/control.c Outdated Show resolved Hide resolved
@christophefontaine
Copy link
Collaborator Author

Interfaces must accept multicast frames: grcli set interface port <port0> allmulti on LLDP is configured globally

I would prefer a list of interfaces with LLDP enabled is set in the lldp module.

This way, the LLDP module request this allmulti stuff (better from a user pov). And I would filter unwanted LLDP frames if received from an iface not in the list.

Shouldn't allmulti be enabled by default, as it is required for IPv6 ?
And then we'd need to have a rx/tx configuration knob for each interface.

@christophefontaine christophefontaine force-pushed the lldp branch 2 times, most recently from 4378c48 to 509dc44 Compare July 5, 2024 11:44
modules/lldp/sink.c Outdated Show resolved Hide resolved
modules/lldp/lldp_priv.h Outdated Show resolved Hide resolved
modules/lldp/sink.c Outdated Show resolved Hide resolved
modules/lldp/announce.c Outdated Show resolved Hide resolved
modules/lldp/announce.c Outdated Show resolved Hide resolved
modules/lldp/announce.c Outdated Show resolved Hide resolved
modules/lldp/control.c Outdated Show resolved Hide resolved
@david-marchand
Copy link
Member

Interfaces must accept multicast frames: grcli set interface port <port0> allmulti on LLDP is configured globally

I would prefer a list of interfaces with LLDP enabled is set in the lldp module.
This way, the LLDP module request this allmulti stuff (better from a user pov). And I would filter unwanted LLDP frames if received from an iface not in the list.

Shouldn't allmulti be enabled by default, as it is required for IPv6 ? And then we'd need to have a rx/tx configuration knob for each interface.

Ideally, no.

Each module requiring multicast traffic should register its set of mcast addresses.
If adding those addresses is not supported (or a limit, like a max number of mac is reached), then allmulti should be enabled.

For the latter case, if the user enables allmulti for debugging, or whatever else, allmulti should still be maintained when the user disables it.
In the Linux kernel, there is a counter of allmulti / promiscuous users to handle this case.

I think grout will need a similar infrastructure code, for adding unicast / mcast address filtering.

@david-marchand
Copy link
Member

LLDP is enabled by default, and may be configured by interface
grcli set lldp iface (default|all|IFACE) (rx|tx|both|off)

and with global parameters
grcli set lldp [ttl 10..600] [sysname <Groot>] [sysdesc <Router>]

grcli show lldp config
grcli show lldp neighbors [iface IFACE] [brief]

Signed-off-by: Christophe Fontaine <[email protected]>
@christophefontaine christophefontaine added the feature New feature or request label Aug 1, 2024
@christophefontaine christophefontaine marked this pull request as ready for review August 1, 2024 11:55
modules/lldp/cli.c Show resolved Hide resolved
Comment on lines +25 to +26
arg_u16(p, "TTL", &ttl);
if (ttl > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe return EINVAL if ttl is 0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TTL value should be already checked when it is parsed (min 10s, max 600s ) in the CLI.
with_help("Interval in seconds, 10 < ttl < 600", ec_node_uint("TTL", 10, 600, 10)),
Here, we only check for existence of the parameter.

modules/lldp/cli.c Show resolved Hide resolved
modules/lldp/cli.c Show resolved Hide resolved
modules/lldp/cli.c Show resolved Hide resolved
modules/lldp/output.c Show resolved Hide resolved
modules/lldp/control.c Show resolved Hide resolved
Comment on lines +50 to +51
uint8_t type,
uint8_t subtype,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see proper naming/sizing of enums in gr_lldp.h.


// Only T_CHASSIS_ID T_PORT_ID T_TTL and T_END are mandatory
lldp_tlv_append(
mbuf, T_CHASSIS_ID, T_CHASSIS_MAC_ADDRESS, RTE_ETHER_ADDR_LEN, src_addr.addr_bytes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit pick:

mbuf, T_CHASSIS_ID, T_CHASSIS_MAC_ADDRESS, sizeof(src_addr), &src_addr

mbuf, T_CHASSIS_ID, T_CHASSIS_IF_ALIAS, strlen(lldp_ctx.sys_name), lldp_ctx.sys_name
);
lldp_tlv_append(
mbuf, T_PORT_ID, T_PORT_MAC_ADDRESS, RTE_ETHER_ADDR_LEN, src_addr.addr_bytes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same:

mbuf, T_CHASSIS_ID, T_CHASSIS_MAC_ADDRESS, sizeof(src_addr), &src_addr

@rjarry rjarry force-pushed the main branch 9 times, most recently from c992f96 to 33f768f Compare September 5, 2024 13:23
@christophefontaine christophefontaine marked this pull request as draft September 24, 2024 14:59
@vjardin
Copy link
Contributor

vjardin commented Oct 6, 2024

Why should a complete LLDP stack be redesigned ? What's about all the LLDP options ?

This stack https://github.com/lldpd/lldpd would be a good fit, but I don't understand the datamodel that could be used for lldpd to leverage grout.

Moreover, it would be a proof point that the integration of a signaling stack is achievable.

cc @vincentbernat

@christophefontaine
Copy link
Collaborator Author

christophefontaine commented Oct 6, 2024 via email

@rjarry rjarry removed the feature New feature or request label Jan 5, 2025
@rjarry rjarry force-pushed the main branch 5 times, most recently from b519766 to aeffe13 Compare January 9, 2025 15:13
@christophefontaine
Copy link
Collaborator Author

Not enough time to work on that, closing to rework properly on it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants