ipaddrlabel: use uint32_t instead of int32_t
Subsystems (2)
PATCH 1/1 ipaddrlabel: use uint32_t instead of int32_t
As both linux kernel and function ipaddrlabel_modify use unsigned int for label. We should also use unsigned int value when print addrlabel in case of misunderstanding.
Signed-off-by Hangbin Liu <[email protected]>
--- ip/ipaddrlabel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
ip/ipaddrlabel.c +3 -3
@@ -86,10 +86,10 @@ int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *argif (ifal->ifal_index)fprintf (fp,"dev %s " ,ll_index_to_name (ifal->ifal_index)); -if (tb[IFAL_LABEL ] &&RTA_PAYLOAD (tb[IFAL_LABEL ]) ==sizeof (int32_t )) { -int32_t label; +if (tb[IFAL_LABEL ] &&RTA_PAYLOAD (tb[IFAL_LABEL ]) ==sizeof (uint32_t )) { +uint32_t label;memcpy (&label,RTA_DATA (tb[IFAL_LABEL ]),sizeof (label)); -fprintf (fp,"label %d " , label); +fprintf (fp,"label %u " , label); }fprintf (fp,"\n" );
Signature · 1 line
1.8.1.4