Check-in [d59eec4e0d]
Overview
SHA1:d59eec4e0dc0ccd87b32dbac8186006a5d282f4c
Date: 2017-03-03 21:53:25
User: rkeene
Comment:Added MTU support
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2017-03-03
21:54
[6a50c2cbad] TUAPI 0.10 (user: rkeene, tags: trunk, 0.10)
21:53
[d59eec4e0d] Added MTU support (user: rkeene, tags: trunk)
2017-01-10
21:29
[923c88acc0] Post-release version increment (user: rkeene, tags: trunk)
Changes

Modified tuapi.c from [c575e12119] to [b5d0abf866].

  1453   1453   
  1454   1454   	return(TCL_OK);
  1455   1455   }
  1456   1456   
  1457   1457   static int tuapi_ifconfig_conf(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock, int sock_v4, int sock_v6) {
  1458   1458   	Tcl_Obj *option_name_obj, *option_val_obj;
  1459   1459   	Tcl_Obj **flags_objv;
         1460  +	Tcl_WideInt option_val_wide;
  1460   1461   	struct ifreq iface_req;
  1461   1462   	struct sockaddr *tmp_ioctl_addr;
  1462   1463   	const char *iface;
  1463   1464   	short flags;
  1464   1465   	int flags_objc;
  1465   1466   	int tmp_sock, tmp_ioctl;
  1466   1467   	int ioctl_ret, tcl_ret, parse_ret;
................................................................................
  1474   1475   	}
  1475   1476   
  1476   1477   	objc -= 2;
  1477   1478   	objv += 2;
  1478   1479   
  1479   1480   	for (; objc > 0; objc--,objv++) {
  1480   1481   		/* Prepare for an ioctl() */
         1482  +		memset(&iface_req, 0, sizeof(iface_req));
  1481   1483   		strcpy(iface_req.ifr_name, iface);
  1482   1484   		tmp_ioctl = -1;
  1483   1485   
  1484   1486   		option_name_obj = objv[0];
  1485   1487   
  1486   1488   		if (objc == 1) {
  1487   1489   			Tcl_SetObjResult(interp, Tcl_ObjPrintf("option \"%s\" requires an argument", Tcl_GetString(option_name_obj)));
................................................................................
  1571   1573   					Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
  1572   1574   
  1573   1575   					return(TCL_ERROR);
  1574   1576   				}
  1575   1577   
  1576   1578   				break;
  1577   1579   			case 0x5e9d03e3: /* metric */
  1578         -			case 0x1b7a75: /* mtu */
  1579   1580   			case 0x7c3891f2: /* hwaddr */
  1580   1581   			case 0xbf72a969: /* addmulti */
  1581   1582   			case 0xba708969: /* delmulti */
  1582   1583   			case 0xdd876e5: /* name */
  1583   1584   					Tcl_SetObjResult(interp, Tcl_ObjPrintf("option \"%s\" unsupported", Tcl_GetString(option_name_obj)));
  1584   1585   
  1585   1586   					return(TCL_ERROR);
         1587  +				break;
         1588  +			case 0x1b7a75: /* mtu */
         1589  +				tcl_ret = Tcl_GetWideIntFromObj(interp, option_val_obj, &option_val_wide);
         1590  +				if (tcl_ret != TCL_OK) {
         1591  +					return(tcl_ret);
         1592  +				}
         1593  +
         1594  +				iface_req.ifr_mtu = option_val_wide;
         1595  +
         1596  +				ioctl_ret = ioctl(sock, SIOCSIFMTU, &iface_req);
         1597  +				if (ioctl_ret != 0) {
         1598  +					Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
         1599  +
         1600  +					return(TCL_ERROR);
         1601  +				}
         1602  +
  1586   1603   				break;
  1587   1604   			case 0x4e9aeaf3: /* address */
  1588   1605   				if (tmp_ioctl == -1) {
  1589   1606   					tmp_ioctl = SIOCSIFADDR;
  1590   1607   					tmp_ioctl_addr = &iface_req.ifr_addr;
  1591   1608   				}
  1592   1609