102 lines
3.8 KiB
Diff
102 lines
3.8 KiB
Diff
--- hplip-1.6.10/io/hpiod/jetdirect.cpp.ipv6 2006-04-18 23:34:15.000000000 +0100
|
|
+++ hplip-1.6.10/io/hpiod/jetdirect.cpp 2006-10-30 13:56:15.000000000 +0000
|
|
@@ -55,23 +55,35 @@
|
|
|
|
int JetDirectChannel::Open(char *sendBuf, int *result)
|
|
{
|
|
- struct sockaddr_in pin;
|
|
+ struct sockaddr_storage pin;
|
|
+ size_t addrlen;
|
|
+ struct addrinfo *hostai;
|
|
JetDirectDevice *pD = (JetDirectDevice *)pDev;
|
|
char buf[LINE_SIZE];
|
|
int r, len, port;
|
|
|
|
*result = R_IO_ERROR;
|
|
|
|
+ if (getaddrinfo (pD->GetIP(), NULL, NULL, &hostai) < 0)
|
|
+ {
|
|
+ syslog(LOG_ERR, "unable to resolve hostname %s\n", pD->GetIP());
|
|
+ goto bugout;
|
|
+ }
|
|
+
|
|
+ addrlen = hostai->ai_addrlen;
|
|
bzero(&pin, sizeof(pin));
|
|
- pin.sin_family = AF_INET;
|
|
- pin.sin_addr.s_addr = inet_addr(pD->GetIP());
|
|
+ memcpy(&pin, hostai->ai_addr, addrlen);
|
|
+ freeaddrinfo(hostai);
|
|
|
|
switch (GetSocketID())
|
|
{
|
|
case PRINT_CHANNEL:
|
|
port = PrintPort[pD->GetPort()];
|
|
- pin.sin_port = htons(port);
|
|
- if ((Socket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
|
|
+ if (pin.ss_family == AF_INET)
|
|
+ ((struct sockaddr_in *)&pin)->sin_port = htons(port);
|
|
+ else if (pin.ss_family == AF_INET6)
|
|
+ ((struct sockaddr_in6 *)&pin)->sin6_port = htons(port);
|
|
+ if ((Socket = socket(pin.ss_family, SOCK_STREAM, 0)) == -1)
|
|
{
|
|
syslog(LOG_ERR, "unable to open print port %d JetDirectChannel::Open: %m %s %s %d\n", port, pDev->GetURI(), __FILE__, __LINE__);
|
|
goto bugout;
|
|
@@ -87,9 +99,11 @@
|
|
port = ScanPort0[pD->GetPort()];
|
|
else
|
|
port = ScanPort1[pD->GetPort()];
|
|
- pin.sin_port = htons(port);
|
|
-
|
|
- if ((Socket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
|
|
+ if (pin.ss_family == AF_INET)
|
|
+ ((struct sockaddr_in *)&pin)->sin_port = htons(port);
|
|
+ else if (pin.ss_family == AF_INET6)
|
|
+ ((struct sockaddr_in6 *)&pin)->sin6_port = htons(port);
|
|
+ if ((Socket = socket(pin.ss_family, SOCK_STREAM, 0)) == -1)
|
|
{
|
|
syslog(LOG_ERR, "unable to open scan port %d JetDirectChannel::Open: %m %s %s %d\n", port, pDev->GetURI(), __FILE__, __LINE__);
|
|
goto bugout;
|
|
@@ -117,8 +131,12 @@
|
|
port = GenericPort[pD->GetPort()];
|
|
else
|
|
port = GenericPort1[pD->GetPort()];
|
|
- pin.sin_port = htons(port);
|
|
- if ((Socket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
|
|
+
|
|
+ if (pin.ss_family == AF_INET)
|
|
+ ((struct sockaddr_in *)&pin)->sin_port = htons(port);
|
|
+ else if (pin.ss_family == AF_INET6)
|
|
+ ((struct sockaddr_in6 *)&pin)->sin6_port = htons(port);
|
|
+ if ((Socket = socket(pin.ss_family, SOCK_STREAM, 0)) == -1)
|
|
{
|
|
syslog(LOG_ERR, "unable to open port %d JetDirectChannel::Open: %m %s %s %d\n", port, pDev->GetURI(), __FILE__, __LINE__);
|
|
goto bugout;
|
|
@@ -158,8 +176,11 @@
|
|
break;
|
|
case EWS_CHANNEL:
|
|
port = 80;
|
|
- pin.sin_port = htons(port);
|
|
- if ((Socket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
|
|
+ if (pin.ss_family == AF_INET)
|
|
+ ((struct sockaddr_in *)&pin)->sin_port = htons(port);
|
|
+ else if (pin.ss_family == AF_INET6)
|
|
+ ((struct sockaddr_in6 *)&pin)->sin6_port = htons(port);
|
|
+ if ((Socket = socket(pin.ss_family, SOCK_STREAM, 0)) == -1)
|
|
{
|
|
syslog(LOG_ERR, "unable to open ews port %d JetDirectChannel::Open: %m %s %s %d\n", port, pDev->GetURI(), __FILE__, __LINE__);
|
|
goto bugout;
|
|
|
|
--- hplip-1.6.10/base/g.py.ipv6 2006-10-30 15:09:12.000000000 +0000
|
|
+++ hplip-1.6.10/base/g.py 2006-10-30 15:09:15.000000000 +0000
|
|
@@ -166,8 +166,8 @@
|
|
prop.hpssd_port = 0
|
|
|
|
|
|
-prop.hpiod_host = 'localhost'
|
|
-prop.hpssd_host = 'localhost'
|
|
+prop.hpiod_host = '127.0.0.1'
|
|
+prop.hpssd_host = '127.0.0.1'
|
|
|
|
prop.username = pwd.getpwuid(os.getuid())[0]
|
|
pdb = pwd.getpwnam(prop.username)
|