Tcl UDP

Check-in [d62a2a4f64]
Login

Check-in [d62a2a4f64]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Typo fix
Timelines: family | ancestors | descendants | both | mcastif
Files: files | file ages | folders
SHA1: d62a2a4f645f55ba63b7c9837a7d541879259c6f
User & Date: hypnotoad 2014-08-22 16:02:36
Context
2014-08-29
15:17
Merging in multicast IF hack check-in: 8afb0cd21c user: hypnotoad tags: trunk
2014-08-22
16:02
Typo fix Leaf check-in: d62a2a4f64 user: hypnotoad tags: mcastif
15:43
Branch to test specifying the interface to use for multicast check-in: ef5c5c83f4 user: hypnotoad tags: mcastif
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/udp_tcl.c.

1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
 * ----------------------------------------------------------------------
 */
static int
udpSetMulticastIFOption(UdpState *statePtr, Tcl_Interp *interp,CONST84 char *newValue)
{
  if (statePtr->ss_family == AF_INET) {
    struct in_addr interface_addr;
    if(inet_aton(statePtr->remotehost,&interface_addr)==0) {
      if (interp != NULL) {
        Tcl_SetObjResult(interp, ErrorToObj("error setting -mcastif (bad IP)"));
      }
      return TCL_ERROR;
    }
    if (setsockopt(statePtr->sock, IPPROTO_IP, IP_MULTICAST_IF, (const char*)&interface_addr, sizeof(interface_addr)) < 0) {
      if (interp != NULL) {
        Tcl_SetObjResult(interp, ErrorToObj("error setting -mcastif"));
      }
      return TCL_ERROR;
    }		
  } else {
    struct in6_addr interface_addr;
    if(inet_pton(AF_INET6,statePtr->remotehost,&interface_addr)==0) {
      if (interp != NULL) {
        Tcl_SetObjResult(interp, ErrorToObj("error setting -mcastif (bad IP)"));
      }
      return TCL_ERROR;
    }
    if (setsockopt(statePtr->sock, IPPROTO_IP, IPV6_MULTICAST_IF, (const char*)&interface_addr, sizeof(interface_addr)) < 0) {
      if (interp != NULL) {







|













|







1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
 * ----------------------------------------------------------------------
 */
static int
udpSetMulticastIFOption(UdpState *statePtr, Tcl_Interp *interp,CONST84 char *newValue)
{
  if (statePtr->ss_family == AF_INET) {
    struct in_addr interface_addr;
    if(inet_aton(newValue,&interface_addr)==0) {
      if (interp != NULL) {
        Tcl_SetObjResult(interp, ErrorToObj("error setting -mcastif (bad IP)"));
      }
      return TCL_ERROR;
    }
    if (setsockopt(statePtr->sock, IPPROTO_IP, IP_MULTICAST_IF, (const char*)&interface_addr, sizeof(interface_addr)) < 0) {
      if (interp != NULL) {
        Tcl_SetObjResult(interp, ErrorToObj("error setting -mcastif"));
      }
      return TCL_ERROR;
    }		
  } else {
    struct in6_addr interface_addr;
    if(inet_pton(AF_INET6,newValue,&interface_addr)==0) {
      if (interp != NULL) {
        Tcl_SetObjResult(interp, ErrorToObj("error setting -mcastif (bad IP)"));
      }
      return TCL_ERROR;
    }
    if (setsockopt(statePtr->sock, IPPROTO_IP, IPV6_MULTICAST_IF, (const char*)&interface_addr, sizeof(interface_addr)) < 0) {
      if (interp != NULL) {