Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Log connection type to aid in IPv6 testing/verification #2046

Closed

Description

@michaelrsweet

Version: 1.3-current
CUPS.org User: jlovell

It would be nice if the backends logged their connection type to aid in IPv6/IPv4 debugging/testing.

Attached patch does this...
It also adds $LIBOBJS to the clean target in the Makefile.

Thanks!

Activity

  1. michaelrsweet commented on Oct 23, 2006

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Fixed in Subversion repository.

  2. michaelrsweet commented on Oct 23, 2006

    @michaelrsweet
    ContributorAuthor

    "ipv6-logging.patch":

    Index: lpd.c

    --- lpd.c (revision 6044)
    +++ lpd.c (working copy)
    @@ -582,6 +582,7 @@
    cptr; / Pointer into control file string /
    char status; /
    Status byte from command /
    char portname[255]; /
    Port name */

    • char addrname[256]; /* Address name /
      http_addrlist_t *addrlist, /
      Address list /
      *addr; /
      Socket address /
      int copy; /
      Copies written */
      @@ -820,9 +821,19 @@

      fputs("STATE: -connecting-to-device\n", stderr);
      fprintf(stderr, "INFO: Connected to %s...\n", hostname);

    • fprintf(stderr, "DEBUG: Connected on ports %d (local %d)...\n", port,

    •        lport);
      

    +#ifdef AF_INET6

    • if (addr->addr.addr.sa_family == AF_INET6)
    •  fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6) (local port %d)...\n", 
      
    •         httpAddrString(&addr->addr, addrname, sizeof(addrname)),
      
    •         ntohs(addr->addr.ipv6.sin6_port), lport);
      
    • else
      +#endif /* AF_INET6 */
    •  if (addr->addr.addr.sa_family == AF_INET)
      
    • fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4) (local port %d)...\n",
    •       httpAddrString(&addr->addr, addrname, sizeof(addrname)),
      
    •       ntohs(addr->addr.ipv4.sin_port), lport);
      
      /*
      • Next, open the print file and figure out its size...
        _/
        Index: ipp.c

        --- ipp.c (revision 6044)
        +++ ipp.c (working copy)
        @@ -106,6 +106,7 @@
        hostname[1024], /_ Hostname /
        username[255], /
        Username info /
        resource[1024], /
        Resource info (printer name) */
    •   addrname[256],      /\* Address name _/
      *optptr,        /_ Pointer to URI options _/
      name[255],      /_ Name of option _/
      value[255],     /_ Value of option */
      
      @@ -573,6 +574,18 @@
      fputs("STATE: -connecting-to-device\n", stderr);
      fprintf(stderr, "INFO: Connected to %s...\n", hostname);

    +#ifdef AF_INET6

    • if (http->hostaddr->addr.sa_family == AF_INET6)
    • fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6)...\n",
    •       httpAddrString(http->hostaddr, addrname, sizeof(addrname)),
      
    •       ntohs(http->hostaddr->ipv6.sin6_port));
      
    • else
      +#endif /* AF_INET6 */
    • if (http->hostaddr->addr.sa_family == AF_INET)
    •  fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4)...\n",
      
    •         httpAddrString(http->hostaddr, addrname, sizeof(addrname)),
      
    •         ntohs(http->hostaddr->ipv4.sin_port));
      
      /*
      • Build a URI for the printer and fill the standard IPP attributes for
      • an IPP_PRINT_FILE request. We can't use the URI in argv[0] because it
        Index: socket.c

        --- socket.c (revision 6044)
        +++ socket.c (working copy)
        @@ -78,7 +78,9 @@
        int delay; /* Delay for retries... /
        int device_fd; /
        AppSocket /
        int error; /
        Error code (if any) */
    • http_addrlist_t addrlist; / Address list */
    • http_addrlist_t addrlist, / Address list */
    •     _addr;        /_ Connected address */
      
    • char addrname[256]; /* Address name /
      ssize_t tbytes; /
      Total number of bytes written /
      struct timeval timeout; /
      Timeout for select() /
      fd_set input; /
      Input set for select() */
      @@ -245,7 +247,7 @@

    for (delay = 5;;)
    {

    • if (!httpAddrConnect(addrlist, &device_fd))
    • if ((addr = httpAddrConnect(addrlist, &device_fd)) == NULL)
      {
      error = errno;
      device_fd = -1;
      @@ -293,7 +295,20 @@
      }

    fputs("STATE: -connecting-to-device\n", stderr);

    • fprintf(stderr, "INFO: Connected to %s...\n", hostname);

    +#ifdef AF_INET6

    • if (addr->addr.addr.sa_family == AF_INET6)

    • fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6)...\n",

    •       httpAddrString(&addr->addr, addrname, sizeof(addrname)),
      
    •       ntohs(addr->addr.ipv6.sin6_port));
      
    • else
      +#endif /* AF_INET6 */

    • if (addr->addr.addr.sa_family == AF_INET)

    •  fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4)...\n",
      
    •         httpAddrString(&addr->addr, addrname, sizeof(addrname)),
      
    •         ntohs(addr->addr.ipv4.sin_port));
      

      /*

      • Print everything...
        */
        Index: Makefile

        --- Makefile (revision 6044)
        +++ Makefile (working copy)
        @@ -46,7 +46,7 @@

      clean:

    • $(RM) $(OBJS) $(TARGETS) http

    • $(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http

  3. added this to the Stable milestone on Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions