Index: Modules/socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.288 diff -c -r1.288 socketmodule.c *** Modules/socketmodule.c 11 Apr 2004 12:02:25 -0000 1.288 --- Modules/socketmodule.c 3 May 2004 22:56:39 -0000 *************** *** 49,57 **** specifying the ethernet interface and an integer specifying the Ethernet protocol number to be received. For example: ("eth0",0x1234). Optional 3rd,4th,5th elements in the tuple ! specify packet-type and ha-type/addr -- these are ignored by ! networking code, but accepted since they are returned by the ! getsockname() method. Local naming conventions: --- 49,55 ---- specifying the ethernet interface and an integer specifying the Ethernet protocol number to be received. For example: ("eth0",0x1234). Optional 3rd,4th,5th elements in the tuple ! specify packet-type and ha-type/addr -- are now accepted and used Local naming conventions: *************** *** 1105,1114 **** int protoNumber; int hatype = 0; int pkttype = 0; ! char *haddr; ! if (!PyArg_ParseTuple(args, "si|iis", &interfaceName, ! &protoNumber, &pkttype, &hatype, &haddr)) return 0; strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name)); ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0'; --- 1103,1114 ---- int protoNumber; int hatype = 0; int pkttype = 0; ! char *haddr = NULL; ! unsigned int halen = 0; ! if (!PyArg_ParseTuple(args, "si|iis#", &interfaceName, ! &protoNumber, &pkttype, &hatype, ! &haddr, &halen)) return 0; strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name)); ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0'; *************** *** 1122,1127 **** --- 1122,1135 ---- addr->sll_ifindex = ifr.ifr_ifindex; addr->sll_pkttype = pkttype; addr->sll_hatype = hatype; + if( halen > 8 ){ + s->errorhandler(); + return 0; + } + if( halen != 0 ){ + memcpy(&addr->sll_addr, haddr, halen); + } + addr->sll_halen = halen; *addr_ret = (struct sockaddr *) addr; *len_ret = sizeof *addr; return 1;