summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-10-21 16:57:47 (GMT)
committerThomas Haller <thaller@redhat.com>2015-10-21 16:58:06 (GMT)
commit015899fd49c3444b502e801b6d394fc3ce1f57a4 (patch)
tree5a980ea0f82be1ba77ab390383c560fe0a5293bd
parent7b9671c6d88fce7e5261e4caa1a9a17f7136eba3 (diff)
downloadlibnl-015899fd49c3444b502e801b6d394fc3ce1f57a4.zip
libnl-015899fd49c3444b502e801b6d394fc3ce1f57a4.tar.gz
libnl-015899fd49c3444b502e801b6d394fc3ce1f57a4.tar.bz2
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 <thaller@redhat.com>
-rw-r--r--lib/route/link/vlan.c8
1 files changed, 5 insertions, 3 deletions
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)
{