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

LLDP: missing net_pkt_set_lldp in lldp_send #25084

Closed
ehudmarvell opened this issue May 7, 2020 · 3 comments · Fixed by #25086
Closed

LLDP: missing net_pkt_set_lldp in lldp_send #25084

ehudmarvell opened this issue May 7, 2020 · 3 comments · Fixed by #25086
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@ehudmarvell
Copy link
Contributor

Sending lldp packet includes ARP field in its eth->type instead LLDP type. ( wireshark is attached)

lldp.zip

Steps to reproduce the behavior:
compile with CONFIG_NET_LLDP=y
add to ethernet driver :

  1. capabilities: ETHERNET_LLDP
  2. net_lldp_set_lldpdu(iface);

I would expect that the driver will send lldp packet instead I see that the packet which should be lldp
packet includes in its ethernet header ptype=ARP(the rest of the packet seem fine).

I think it because net_pkt_set_lldp(pkt, true); is missing from lldp_send function.
As result ethernet_send not inserted to

} else if (IS_ENABLED(CONFIG_NET_LLDP) && net_pkt_is_lldp(pkt)) {
ptype = htons(NET_ETH_PTYPE_LLDP);

and it inserted to instead

} else if (IS_ENABLED(CONFIG_NET_ARP)) {
/* Unktown type: Unqueued pkt is an ARP reply.
*/
ptype = htons(NET_ETH_PTYPE_ARP);
net_pkt_set_family(pkt, AF_INET);
}

Environment (please complete the following information):

  • Zephyr SDK
  • Commit SHA :6933248e0cb4f7af31e2bab5b39c594806ab53ac

What do you think?

Thanks,
Ehud

@ehudmarvell ehudmarvell added the bug The issue is a bug, or the PR is fixing a bug label May 7, 2020
@jukkar
Copy link
Member

jukkar commented May 7, 2020

Yep, your analysis is correct. The fix is easy, I will send a fix shortly.

jukkar added a commit to jukkar/zephyr that referenced this issue May 7, 2020
The LLDP packet was created but its type was not set to LLDP
and was sent as ARP message.

Fixes zephyrproject-rtos#25084

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
@jukkar
Copy link
Member

jukkar commented May 7, 2020

After the fix, the Ethernet type is correct. Unfortunately wireshark shows now that the packet is malformed when testing this with samples/net/lldp sample.

Edit: at least in native_posix where I tested this, the sent Ethernet frame is too short so wireshark complains about this but the actual LLDP frame seems to be ok.

@jukkar jukkar added the priority: medium Medium impact/importance bug label May 7, 2020
@ehudmarvell
Copy link
Contributor Author

@jukkar thank you, I don't see any problem after the fix in my wireshark

jukkar added a commit that referenced this issue May 8, 2020
The LLDP packet was created but its type was not set to LLDP
and was sent as ARP message.

Fixes #25084

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
hakehuang pushed a commit to hakehuang/zephyr that referenced this issue Jun 20, 2020
The LLDP packet was created but its type was not set to LLDP
and was sent as ARP message.

Fixes zephyrproject-rtos#25084

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants