[PATCH] sock.c [LINUX] (sock_ioctl): Parse more SIOCS* ioctls

Dmitry V. Levin ldv at altlinux.org
Tue Nov 11 00:32:46 UTC 2008


 sock.c |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

--- sock.c
+++ sock.c
@@ -134,26 +134,38 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
 		return 1;
 #ifdef LINUX
 	case SIOCGIFNAME:
+	case SIOCSIFNAME:
 	case SIOCGIFINDEX:
 	case SIOCGIFADDR:
+	case SIOCSIFADDR:
 	case SIOCGIFDSTADDR:
+	case SIOCSIFDSTADDR:
 	case SIOCGIFBRDADDR:
+	case SIOCSIFBRDADDR:
 	case SIOCGIFNETMASK:
+	case SIOCSIFNETMASK:
 	case SIOCGIFFLAGS:
+	case SIOCSIFFLAGS:
 	case SIOCGIFMETRIC:
+	case SIOCSIFMETRIC:
 	case SIOCGIFMTU:
+	case SIOCSIFMTU:
 	case SIOCGIFSLAVE:
+	case SIOCSIFSLAVE:
 	case SIOCGIFHWADDR:
+	case SIOCSIFHWADDR:
 	case SIOCGIFTXQLEN:
+	case SIOCSIFTXQLEN:
 	case SIOCGIFMAP:
+	case SIOCSIFMAP:
 		if (umove(tcp, tcp->u_arg[2], &ifr) < 0)
 			tprintf(", %#lx", tcp->u_arg[2]);
 		else if (syserror(tcp)) {
-			if (code == SIOCGIFNAME)
+			if (code == SIOCGIFNAME || code == SIOCSIFNAME)
 				tprintf(", {ifr_index=%d, ifr_name=???}", ifr.ifr_ifindex);
 			else
 				tprintf(", {ifr_name=\"%s\", ???}", ifr.ifr_name);
-		} else if (code == SIOCGIFNAME)
+		} else if (code == SIOCGIFNAME || code == SIOCSIFNAME)
 			tprintf(", {ifr_index=%d, ifr_name=\"%s\"}",
 				ifr.ifr_ifindex, ifr.ifr_name);
 		else {
@@ -163,15 +175,19 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
 				tprintf("ifr_index=%d", ifr.ifr_ifindex);
 				break;
 			case SIOCGIFADDR:
+			case SIOCSIFADDR:
 				str = "ifr_addr";
 			case SIOCGIFDSTADDR:
-				if (str == NULL)
+			case SIOCSIFDSTADDR:
+				if (!str)
 					str = "ifr_dstaddr";
 			case SIOCGIFBRDADDR:
-				if (str == NULL)
+			case SIOCSIFBRDADDR:
+				if (!str)
 					str = "ifr_broadaddr";
 			case SIOCGIFNETMASK:
-				if (str == NULL)
+			case SIOCSIFNETMASK:
+				if (!str)
 					str = "ifr_netmask";
 				tprintf("%s={", str);
 				printxval(addrfams,
@@ -185,6 +201,7 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
 				tprintf("}");
 				break;
 			case SIOCGIFHWADDR:
+			case SIOCSIFHWADDR:
 				/* XXX Are there other hardware addresses
 				   than 6-byte MACs?  */
 				bytes = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
@@ -193,22 +210,28 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
 					bytes[3], bytes[4], bytes[5]);
 				break;
 			case SIOCGIFFLAGS:
+			case SIOCSIFFLAGS:
 				tprintf("ifr_flags=");
 				printflags(iffflags, ifr.ifr_flags, "IFF_???");
 				break;
 			case SIOCGIFMETRIC:
+			case SIOCSIFMETRIC:
 				tprintf("ifr_metric=%d", ifr.ifr_metric);
 				break;
 			case SIOCGIFMTU:
+			case SIOCSIFMTU:
 				tprintf("ifr_mtu=%d", ifr.ifr_mtu);
 				break;
 			case SIOCGIFSLAVE:
+			case SIOCSIFSLAVE:
 				tprintf("ifr_slave=\"%s\"", ifr.ifr_slave);
 				break;
 			case SIOCGIFTXQLEN:
+			case SIOCSIFTXQLEN:
 				tprintf("ifr_qlen=%d", ifr.ifr_qlen);
 				break;
 			case SIOCGIFMAP:
+			case SIOCSIFMAP:
 				tprintf("ifr_map={mem_start=%#lx, "
 					"mem_end=%#lx, base_addr=%#x, "
 					"irq=%u, dma=%u, port=%u}",


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20081111/2d049da3/attachment.bin>


More information about the Strace-devel mailing list