]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/blobdiff - ip/ipaddress.c
Convert to use rta_getattr_ functions
[lisovros/iproute2_canprio.git] / ip / ipaddress.c
index 9306a372827d192ceb9f72fe05bfc7e8593ed6c5..9ab65ec78e2224290024ec1ef2a6c4cd67890d20 100644 (file)
@@ -155,7 +155,7 @@ static void print_queuelen(FILE *f, struct rtattr *tb[IFLA_MAX + 1])
                        return;
 
                memset(&ifr, 0, sizeof(ifr));
-               strcpy(ifr.ifr_name, (char *)RTA_DATA(tb[IFLA_IFNAME]));
+               strcpy(ifr.ifr_name, rta_getattr_str(tb[IFLA_IFNAME]));
                if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) {
                        fprintf(f, "ioctl(SIOCGIFXQLEN) failed: %s\n", strerror(errno));
                        close(s);
@@ -397,7 +397,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
                fprintf(fp, "Deleted ");
 
        fprintf(fp, "%d: %s", ifi->ifi_index,
-               tb[IFLA_IFNAME] ? (char*)RTA_DATA(tb[IFLA_IFNAME]) : "<nil>");
+               tb[IFLA_IFNAME] ? rta_getattr_str(tb[IFLA_IFNAME]) : "<nil>");
 
        if (tb[IFLA_LINK]) {
                SPRINT_BUF(b1);
@@ -417,14 +417,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
        if (tb[IFLA_MTU])
                fprintf(fp, "mtu %u ", *(int*)RTA_DATA(tb[IFLA_MTU]));
        if (tb[IFLA_QDISC])
-               fprintf(fp, "qdisc %s ", (char*)RTA_DATA(tb[IFLA_QDISC]));
+               fprintf(fp, "qdisc %s ", rta_getattr_str(tb[IFLA_QDISC]));
        if (tb[IFLA_MASTER]) {
                SPRINT_BUF(b1);
                fprintf(fp, "master %s ", ll_idx_n2a(*(int*)RTA_DATA(tb[IFLA_MASTER]), b1));
        }
 
        if (tb[IFLA_OPERSTATE])
-               print_operstate(fp, *(__u8 *)RTA_DATA(tb[IFLA_OPERSTATE]));
+               print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE]));
 
        if (do_link && tb[IFLA_LINKMODE])
                print_linkmode(fp, tb[IFLA_LINKMODE]);
@@ -460,7 +460,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
 
        if (do_link && tb[IFLA_IFALIAS])
                fprintf(fp,"\n    alias %s", 
-                       (const char *) RTA_DATA(tb[IFLA_IFALIAS]));
+                       rta_getattr_str(tb[IFLA_IFALIAS]));
 
        if (do_link && show_stats) {
                if (tb[IFLA_STATS64])
@@ -665,7 +665,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
        if (ifa_flags)
                fprintf(fp, "flags %02x ", ifa_flags);
        if (rta_tb[IFA_LABEL])
-               fprintf(fp, "%s", (char*)RTA_DATA(rta_tb[IFA_LABEL]));
+               fprintf(fp, "%s", rta_getattr_str(rta_tb[IFA_LABEL]));
        if (rta_tb[IFA_CACHEINFO]) {
                struct ifa_cacheinfo *ci = RTA_DATA(rta_tb[IFA_CACHEINFO]);
                fprintf(fp, "%s", _SL_);