From: Thomas Haller Date: Wed, 21 Oct 2015 16:57:47 +0000 (+0200) Subject: rtnl/link: document vlan-protocol to be exposed in network-byte order X-Git-Tag: libnl3_2_28rc1~35^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=015899fd49c3444b502e801b6d394fc3ce1f57a4;p=libnl rtnl/link: document vlan-protocol to be exposed in network-byte order Unfortunately this was done wrong. Instead of fixing it now (and change behavior), document the behavior. Fixes: 430eb4004ab7f93fd840e9836d4bc9220d3c406d Signed-off-by: Thomas Haller --- diff --git a/lib/route/link/vlan.c b/lib/route/link/vlan.c index a623bbd..4aa5c29 100644 --- a/lib/route/link/vlan.c +++ b/lib/route/link/vlan.c @@ -203,7 +203,7 @@ static void vlan_dump_details(struct rtnl_link *link, struct nl_dump_params *p) nl_dump_line(p, " vlan-info id %d <%s>", vi->vi_vlan_id, buf); if (vi->vi_mask & VLAN_HAS_PROTOCOL) - nl_dump_line(p, " vlan protocol <%d>", vi->vi_protocol); + nl_dump_line(p, " vlan protocol <%d>", ntohs(vi->vi_protocol)); nl_dump(p, "\n"); @@ -431,7 +431,8 @@ int rtnl_link_vlan_get_id(struct rtnl_link *link) /** * Set VLAN protocol * @arg link Link object - * @arg protocol VLAN protocol + * @arg protocol VLAN protocol in network byte order. + * Probably you want to set it to something like htons(ETH_P_8021Q). * * @return 0 on success or a negative error code */ @@ -451,7 +452,8 @@ int rtnl_link_vlan_set_protocol(struct rtnl_link *link, uint16_t protocol) * Get VLAN protocol * @arg link Link object * - * @return VLAN protocol, 0 if not set or a negative error code. + * @return VLAN protocol in network byte order like htons(ETH_P_8021Q), + * 0 if not set or a negative error code. */ int rtnl_link_vlan_get_protocol(struct rtnl_link *link) {