From: Dmitry V. Levin Date: Fri, 31 Oct 2014 19:36:01 +0000 (+0000) Subject: sock: decode SIOCSIFNAME on entering syscall X-Git-Tag: v4.10~378 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=788c0d660d91032d6ce4ac646d86b20dc56e11ea;p=strace sock: decode SIOCSIFNAME on entering syscall * sock.c (sock_ioctl): Handle SIOCSIFNAME on entering syscall. --- diff --git a/sock.c b/sock.c index 7f653dcd..546c651c 100644 --- a/sock.c +++ b/sock.c @@ -60,12 +60,22 @@ sock_ioctl(struct tcb *tcp, long code, long arg) unsigned char *bytes; if (entering(tcp)) { - if (code == SIOCGIFCONF) { + switch (code) { + case SIOCGIFCONF: if (umove(tcp, tcp->u_arg[2], &ifc) >= 0 && ifc.ifc_buf == NULL) tprintf(", {%d -> ", ifc.ifc_len); else tprints(", {"); + break; + case SIOCSIFNAME: + if (umove(tcp, tcp->u_arg[2], &ifr) < 0) + tprintf(", %#lx", tcp->u_arg[2]); + else + tprintf(", {ifr_name=\"%.*s\", ifr_newname=\"%.*s\"}", + IFNAMSIZ, ifr.ifr_name, + IFNAMSIZ, ifr.ifr_newname); + break; } return 0; } @@ -99,9 +109,9 @@ sock_ioctl(struct tcb *tcp, long code, long arg) case SIOCATMARK: #endif printnum(tcp, arg, ", %#d"); + case SIOCSIFNAME: return 1; case SIOCGIFNAME: - case SIOCSIFNAME: case SIOCGIFINDEX: case SIOCGIFADDR: case SIOCSIFADDR: @@ -132,14 +142,8 @@ sock_ioctl(struct tcb *tcp, long code, long arg) tprintf(", {ifr_index=%d, ifr_name=???}", ifr.ifr_ifindex); } else { - tprintf(", {ifr_name=\"%.*s\", ", + tprintf(", {ifr_name=\"%.*s\", ???}", IFNAMSIZ, ifr.ifr_name); - - if (code == SIOCSIFNAME) - tprintf("ifr_newname=\"%.*s\"}", - IFNAMSIZ, ifr.ifr_newname); - else - tprintf("???}"); } } else if (code == SIOCGIFNAME) { tprintf(", {ifr_index=%d, ifr_name=\"%.*s\"}", @@ -199,10 +203,6 @@ sock_ioctl(struct tcb *tcp, long code, long arg) case SIOCSIFMTU: tprintf("ifr_mtu=%d", ifr.ifr_mtu); break; - case SIOCSIFNAME: - tprintf("ifr_newname=\"%.*s\"", - IFNAMSIZ, ifr.ifr_newname); - break; case SIOCGIFSLAVE: case SIOCSIFSLAVE: tprintf("ifr_slave=\"%s\"", ifr.ifr_slave);