diff -uNr openssh-3.7.1p2.orig/canohost.c openssh-3.7.1p2.llc/canohost.c --- openssh-3.7.1p2.orig/canohost.c 2003-08-07 00:29:04.000000000 -0300 +++ openssh-3.7.1p2.llc/canohost.c 2003-11-06 12:17:23.000000000 -0200 @@ -68,7 +68,7 @@ if (from.ss_family == AF_INET6) fromlen = sizeof(struct sockaddr_in6); - if (getnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop), + if (mygetnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST) != 0) fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed"); @@ -80,7 +80,7 @@ debug3("Trying to reverse map address %.100s.", ntop); /* Map the IP address to a host name. */ - if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), + if (mygetnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), NULL, 0, NI_NAMEREQD) != 0) { /* Host name not found. Use ip address. */ return xstrdup(ntop); @@ -94,7 +94,7 @@ memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_flags = AI_NUMERICHOST; - if (getaddrinfo(name, "0", &hints, &ai) == 0) { + if (mygetaddrinfo(name, "0", &hints, &ai) == 0) { logit("Nasty PTR record \"%s\" is set up for %s, ignoring", name, ntop); freeaddrinfo(ai); @@ -120,14 +120,14 @@ memset(&hints, 0, sizeof(hints)); hints.ai_family = from.ss_family; hints.ai_socktype = SOCK_STREAM; - if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { + if (mygetaddrinfo(name, NULL, &hints, &aitop) != 0) { logit("reverse mapping checking getaddrinfo for %.700s " "failed - POSSIBLE BREAKIN ATTEMPT!", name); return xstrdup(ntop); } /* Look for the address from the list of addresses. */ for (ai = aitop; ai; ai = ai->ai_next) { - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop2, + if (mygetnameinfo(ai->ai_addr, ai->ai_addrlen, ntop2, sizeof(ntop2), NULL, 0, NI_NUMERICHOST) == 0 && (strcmp(ntop, ntop2) == 0)) break; @@ -246,7 +246,7 @@ addrlen = sizeof(struct sockaddr_in6); /* Get the address in ascii. */ - if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop), + if (mygetnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop), NULL, 0, flags) != 0) { error("get_socket_address: getnameinfo %d failed", flags); return NULL; @@ -345,7 +345,7 @@ fromlen = sizeof(struct sockaddr_in6); /* Return port number. */ - if (getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, + if (mygetnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, strport, sizeof(strport), NI_NUMERICSERV) != 0) fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed"); return atoi(strport); diff -uNr openssh-3.7.1p2.orig/channels.c openssh-3.7.1p2.llc/channels.c --- openssh-3.7.1p2.orig/channels.c 2003-09-16 18:34:12.000000000 -0300 +++ openssh-3.7.1p2.llc/channels.c 2003-11-06 12:09:54.000000000 -0200 @@ -128,7 +128,7 @@ #define NUM_SOCKS 10 -/* AF_UNSPEC or AF_INET or AF_INET6 */ +/* AF_UNSPEC or AF_INET or AF_INET6 or AF_LLC */ static int IPv4or6 = AF_UNSPEC; /* helper */ @@ -2156,13 +2156,14 @@ hints.ai_flags = gateway_ports ? AI_PASSIVE : 0; hints.ai_socktype = SOCK_STREAM; snprintf(strport, sizeof strport, "%d", listen_port); - if (getaddrinfo(NULL, strport, &hints, &aitop) != 0) + if (mygetaddrinfo(NULL, strport, &hints, &aitop) != 0) packet_disconnect("getaddrinfo: fatal error"); for (ai = aitop; ai; ai = ai->ai_next) { - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) + if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6 && + ai->ai_family != AF_LLC) continue; - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), + if (mygetnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV) != 0) { error("channel_setup_fwd_listener: getnameinfo failed"); continue; @@ -2381,15 +2382,16 @@ hints.ai_family = IPv4or6; hints.ai_socktype = SOCK_STREAM; snprintf(strport, sizeof strport, "%d", port); - if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) { + if ((gaierr = mygetaddrinfo(host, strport, &hints, &aitop)) != 0) { error("connect_to %.100s: unknown host (%s)", host, gai_strerror(gaierr)); return -1; } for (ai = aitop; ai; ai = ai->ai_next) { - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) + if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6 && + ai->ai_family != AF_LLC) continue; - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), + if (mygetnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV) != 0) { error("connect_to: getnameinfo failed"); continue; @@ -2488,12 +2490,14 @@ hints.ai_flags = x11_use_localhost ? 0: AI_PASSIVE; hints.ai_socktype = SOCK_STREAM; snprintf(strport, sizeof strport, "%d", port); - if ((gaierr = getaddrinfo(NULL, strport, &hints, &aitop)) != 0) { + if ((gaierr = mygetaddrinfo(NULL, strport, &hints, &aitop)) != 0) { error("getaddrinfo: %.100s", gai_strerror(gaierr)); return -1; } for (ai = aitop; ai; ai = ai->ai_next) { - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) + if (ai->ai_family != AF_INET && + ai->ai_family != AF_INET6 && + ai->ai_family != AF_LLC) continue; sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); @@ -2656,7 +2660,7 @@ hints.ai_family = IPv4or6; hints.ai_socktype = SOCK_STREAM; snprintf(strport, sizeof strport, "%d", 6000 + display_number); - if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) { + if ((gaierr = mygetaddrinfo(buf, strport, &hints, &aitop)) != 0) { error("%.100s: unknown host. (%s)", buf, gai_strerror(gaierr)); return -1; } diff -uNr openssh-3.7.1p2.orig/llc.h openssh-3.7.1p2.llc/llc.h --- openssh-3.7.1p2.orig/llc.h 1969-12-31 21:00:00.000000000 -0300 +++ openssh-3.7.1p2.llc/llc.h 2003-11-06 12:09:54.000000000 -0200 @@ -0,0 +1,80 @@ +#ifndef __LINUX_LLC_H +#define __LINUX_LLC_H +/* + * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators. + * + * Copyright (c) 2001 by Jay Schulist + * + * This program can be redistributed or modified under the terms of the + * GNU General Public License as published by the Free Software Foundation. + * This program is distributed without any warranty or implied warranty + * of merchantability or fitness for a particular purpose. + * + * See the GNU General Public License for more details. + */ +#define __LLC_SOCK_SIZE__ 16 /* sizeof(sockaddr_llc), word align. */ +struct sockaddr_llc { + sa_family_t sllc_family; /* AF_LLC */ + sa_family_t sllc_arphrd; /* ARPHRD_ETHER */ + unsigned char sllc_test; + unsigned char sllc_xid; + unsigned char sllc_ua; /* UA data, only for SOCK_STREAM. */ + unsigned char sllc_sap; + unsigned char sllc_mac[IFHWADDRLEN]; + unsigned char __pad[__LLC_SOCK_SIZE__ - sizeof(sa_family_t) * 2 - + sizeof(unsigned char) * 4 - IFHWADDRLEN]; +}; + +/* sockopt definitions. */ +enum llc_sockopts { + LLC_OPT_UNKNOWN = 0, + LLC_OPT_RETRY, /* max retrans attempts. */ + LLC_OPT_SIZE, /* max PDU size (octets). */ + LLC_OPT_ACK_TMR_EXP, /* ack expire time (secs). */ + LLC_OPT_P_TMR_EXP, /* pf cycle expire time (secs). */ + LLC_OPT_REJ_TMR_EXP, /* rej sent expire time (secs). */ + LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ + LLC_OPT_TX_WIN, /* tx window size. */ + LLC_OPT_RX_WIN, /* rx window size. */ + LLC_OPT_MAX +}; + +#define LLC_OPT_MAX_RETRY 100 +#define LLC_OPT_MAX_SIZE 4196 +#define LLC_OPT_MAX_WIN 127 +#define LLC_OPT_MAX_ACK_TMR_EXP 60 +#define LLC_OPT_MAX_P_TMR_EXP 60 +#define LLC_OPT_MAX_REJ_TMR_EXP 60 +#define LLC_OPT_MAX_BUSY_TMR_EXP 60 + +/* LLC SAP types. */ +#define LLC_SAP_NULL 0x00 /* NULL SAP. */ +#define LLC_SAP_LLC 0x02 /* LLC Sublayer Managment. */ +#define LLC_SAP_SNA 0x04 /* SNA Path Control. */ +#define LLC_SAP_PNM 0x0E /* Proway Network Managment. */ +#define LLC_SAP_IP 0x06 /* TCP/IP. */ +#define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */ +#define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */ +#define LLC_SAP_8208 0x7E /* ISO 8208 */ +#define LLC_SAP_3COM 0x80 /* 3COM. */ +#define LLC_SAP_PRO 0x8E /* Proway Active Station List */ +#define LLC_SAP_SNAP 0xAA /* SNAP. */ +#define LLC_SAP_BANYAN 0xBC /* Banyan. */ +#define LLC_SAP_IPX 0xE0 /* IPX/SPX. */ +#define LLC_SAP_NETBEUI 0xF0 /* NetBEUI. */ +#define LLC_SAP_LANMGR 0xF4 /* LanManager. */ +#define LLC_SAP_IMPL 0xF8 /* IMPL */ +#define LLC_SAP_DISC 0xFC /* Discovery */ +#define LLC_SAP_OSI 0xFE /* OSI Network Layers. */ +#define LLC_SAP_LAR 0xDC /* LAN Address Resolution */ +#define LLC_SAP_RM 0xD4 /* Resource Management */ +#define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ + +#ifdef __KERNEL__ +#define LLC_SAP_DYN_START 0xC0 +#define LLC_SAP_DYN_STOP 0xDE +#define LLC_SAP_DYN_TRIES 4 + +#define llc_ui_skb_cb(__skb) ((struct sockaddr_llc *)&((__skb)->cb[0])) +#endif /* __KERNEL__ */ +#endif /* __LINUX_LLC_H */ diff -uNr openssh-3.7.1p2.orig/misc.c openssh-3.7.1p2.llc/misc.c --- openssh-3.7.1p2.orig/misc.c 2003-09-23 05:59:08.000000000 -0300 +++ openssh-3.7.1p2.llc/misc.c 2003-11-06 12:09:54.000000000 -0200 @@ -28,6 +28,14 @@ #include "misc.h" #include "log.h" #include "xmalloc.h" +#include +#include +#if 0 +#include +// till we have this header in glibc-devel +#else +#include "llc.h" +#endif /* remove newline at end of string */ char * @@ -326,3 +334,106 @@ args->list[args->num++] = xstrdup(buf); args->list[args->num] = NULL; } + +int +llcgetaddrinfo(const char *node, const char *service, + const struct addrinfo *hints, + struct addrinfo **res) +{ + char *x; + unsigned char port; + struct ether_addr e; + struct addrinfo *ai; + struct sockaddr_llc *sllc; + int rc = EAI_NONAME; + + if (node && !ether_aton_r(node, &e) && ether_hostton(node, &e)) + goto out; + rc = EAI_MEMORY; + ai = malloc(sizeof(*ai)); + if (!ai) + goto out_mem_ai; + sllc = malloc(sizeof(*sllc)); + if (!sllc) + goto out_mem_sllc; + memset(ai, 0, sizeof(*ai)); + memset(sllc, 0, sizeof(*sllc)); + ai->ai_next = 0; + ai->ai_family = AF_LLC; + ai->ai_socktype = SOCK_STREAM; + ai->ai_addrlen = sizeof(*sllc); + ai->ai_addr = (struct sockaddr *)sllc; + sllc->sllc_family = AF_LLC; + sllc->sllc_arphrd = ARPHRD_ETHER; + port = strtol(service ? service : "0", &x, 0); + if (*x) { /* service is not numeric */ + struct servent* se = getservbyname(service, "llc"); + + rc = EAI_SERVICE; + if (!se) + goto out_service; + port = se->s_port; + } + if (node) + memcpy(sllc->sllc_mac, e.ether_addr_octet, IFHWADDRLEN); + sllc->sllc_sap = port; + rc = 0; + *res = ai; +out: + return rc; +out_service: + free(sllc); +out_mem_sllc: + free(ai); +out_mem_ai: + rc = EAI_MEMORY; + goto out; +} + +int +mygetaddrinfo(const char *node, const char *service, + const struct addrinfo *hints, + struct addrinfo **res) +{ + if (hints->ai_family == AF_LLC) + return llcgetaddrinfo(node, service, hints, res); + return getaddrinfo(node, service, hints, res); +} + +int llcgetnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags) +{ + struct sockaddr_llc *sllc = (struct sockaddr_llc *)sa; + + if (host && hostlen > 0) { /* resolve host */ + char name[64]; + struct ether_addr *eth = (struct ether_addr *)sllc->sllc_mac; + if ((flags & NI_NUMERICHOST) || + ether_ntohost(name, eth)) + ether_ntoa_r(eth, name); + strncpy(host, name, hostlen - 1); + host[hostlen - 1] = '\0'; + } + if (serv && servlen > 0) { /* resolve service */ + struct servent *s; + + snprintf(serv, servlen - 1, "%d", sllc->sllc_sap); + + if (!(flags & NI_NUMERICHOST) && + (s = getservbyport(sllc->sllc_sap, "llc") != NULL)) + strncpy(serv, s->s_name, servlen - 1); + serv[servlen - 1] = '\0'; + } + return 0; +} + +int mygetnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags) +{ + sa_family_t f = ((struct sockaddr_storage *)sa)->ss_family; + + if (f == AF_LLC) + return llcgetnameinfo(sa, salen, host, hostlen, + serv, servlen, flags); + return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags); +} diff -uNr openssh-3.7.1p2.orig/misc.h openssh-3.7.1p2.llc/misc.h --- openssh-3.7.1p2.orig/misc.h 2003-08-24 22:16:21.000000000 -0300 +++ openssh-3.7.1p2.llc/misc.h 2003-11-06 12:11:11.000000000 -0200 @@ -31,3 +31,14 @@ int nalloc; }; void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3))); + +#ifndef AF_LLC +#define AF_LLC 26 +#endif + +int mygetaddrinfo(const char *node, const char *service, + const struct addrinfo *hints, + struct addrinfo **res); +int mygetnameinfo(const struct sockaddr *sa, socklen_t salen, + char *host, size_t hostlen, char *serv, + size_t servlen, int flags); diff -uNr openssh-3.7.1p2.orig/packet.c openssh-3.7.1p2.llc/packet.c --- openssh-3.7.1p2.orig/packet.c 2003-09-23 06:00:41.000000000 -0300 +++ openssh-3.7.1p2.llc/packet.c 2003-11-06 12:09:54.000000000 -0200 @@ -190,7 +190,8 @@ return 0; if (fromlen != tolen || memcmp(&from, &to, fromlen) != 0) return 0; - if (from.ss_family != AF_INET && from.ss_family != AF_INET6) + if (from.ss_family != AF_INET && from.ss_family != AF_INET6 && + from.ss_family != AF_LLC) return 0; return 1; } diff -uNr openssh-3.7.1p2.orig/readconf.c openssh-3.7.1p2.llc/readconf.c --- openssh-3.7.1p2.orig/readconf.c 2003-09-02 09:58:22.000000000 -0300 +++ openssh-3.7.1p2.llc/readconf.c 2003-11-06 12:21:59.000000000 -0200 @@ -718,6 +718,8 @@ value = AF_INET; else if (strcasecmp(arg, "inet6") == 0) value = AF_INET6; + else if (strcasecmp(arg, "llc") == 0) + value = AF_LLC; else if (strcasecmp(arg, "any") == 0) value = AF_UNSPEC; else diff -uNr openssh-3.7.1p2.orig/scp.c openssh-3.7.1p2.llc/scp.c --- openssh-3.7.1p2.orig/scp.c 2003-08-21 20:34:41.000000000 -0300 +++ openssh-3.7.1p2.llc/scp.c 2003-11-06 12:09:54.000000000 -0200 @@ -231,12 +231,13 @@ addargs(&args, "-oClearAllForwardings yes"); fflag = tflag = 0; - while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q1246S:o:F:")) != -1) + while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q12456S:o:F:")) != -1) switch (ch) { /* User-visible flags. */ case '1': case '2': case '4': + case '5': case '6': case 'C': addargs(&args, "-%c", ch); @@ -1018,7 +1019,7 @@ usage(void) { (void) fprintf(stderr, - "usage: scp [-pqrvBC1246] [-F config] [-S program] [-P port]\n" + "usage: scp [-pqrvBC12456] [-F config] [-S program] [-P port]\n" " [-c cipher] [-i identity] [-l limit] [-o option]\n" " [[user@]host1:]file1 [...] [[user@]host2:]file2\n"); exit(1); diff -uNr openssh-3.7.1p2.orig/servconf.c openssh-3.7.1p2.llc/servconf.c --- openssh-3.7.1p2.orig/servconf.c 2003-09-23 06:24:21.000000000 -0300 +++ openssh-3.7.1p2.llc/servconf.c 2003-11-06 12:09:54.000000000 -0200 @@ -27,7 +27,7 @@ static void add_listen_addr(ServerOptions *, char *, u_short); static void add_one_listen_addr(ServerOptions *, char *, u_short); -/* AF_UNSPEC or AF_INET or AF_INET6 */ +/* AF_UNSPEC or AF_INET or AF_INET6 or AF_LLC */ extern int IPv4or6; /* Use of privilege separation or not */ extern int use_privsep; @@ -403,7 +403,7 @@ hints.ai_socktype = SOCK_STREAM; hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; snprintf(strport, sizeof strport, "%u", port); - if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) + if ((gaierr = mygetaddrinfo(addr, strport, &hints, &aitop)) != 0) fatal("bad addr or host: %s (%s)", addr ? addr : "", gai_strerror(gaierr)); diff -uNr openssh-3.7.1p2.orig/ssh-keyscan.c openssh-3.7.1p2.llc/ssh-keyscan.c --- openssh-3.7.1p2.orig/ssh-keyscan.c 2003-08-21 20:34:41.000000000 -0300 +++ openssh-3.7.1p2.llc/ssh-keyscan.c 2003-11-06 12:09:54.000000000 -0200 @@ -29,7 +29,8 @@ #include "atomicio.h" #include "misc.h" -/* Flag indicating whether IPv4 or IPv6. This can be set on the command line. +/* Flag indicating whether IPv4, IPv6 or LLC. This can be set on the command + line. Default value is AF_UNSPEC means both IPv4 and IPv6. */ int IPv4or6 = AF_UNSPEC; @@ -390,7 +391,7 @@ memset(&hints, 0, sizeof(hints)); hints.ai_family = IPv4or6; hints.ai_socktype = SOCK_STREAM; - if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) + if ((gaierr = mygetaddrinfo(host, strport, &hints, &aitop)) != 0) fatal("getaddrinfo %s: %s", host, gai_strerror(gaierr)); for (ai = aitop; ai; ai = ai->ai_next) { s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); @@ -705,7 +706,7 @@ if (argc <= 1) usage(); - while ((opt = getopt(argc, argv, "v46p:T:t:f:")) != -1) { + while ((opt = getopt(argc, argv, "v456p:T:t:f:")) != -1) { switch (opt) { case 'p': ssh_port = a2port(optarg); @@ -760,6 +761,9 @@ case '4': IPv4or6 = AF_INET; break; + case '5': + IPv4or6 = AF_LLC; + break; case '6': IPv4or6 = AF_INET6; break; diff -uNr openssh-3.7.1p2.orig/ssh.c openssh-3.7.1p2.llc/ssh.c --- openssh-3.7.1p2.orig/ssh.c 2003-09-02 09:58:22.000000000 -0300 +++ openssh-3.7.1p2.llc/ssh.c 2003-11-06 12:12:58.000000000 -0200 @@ -184,6 +184,7 @@ fprintf(stderr, " -1 Force protocol version 1.\n"); fprintf(stderr, " -2 Force protocol version 2.\n"); fprintf(stderr, " -4 Use IPv4 only.\n"); + fprintf(stderr, " -5 Use LLC only.\n"); fprintf(stderr, " -6 Use IPv6 only.\n"); fprintf(stderr, " -o 'option' Process the option as if it was read from a configuration file.\n"); fprintf(stderr, " -s Invoke command (mandatory) as SSH2 subsystem.\n"); @@ -264,7 +265,7 @@ again: while ((opt = getopt(ac, av, - "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:L:NPR:TVX")) != -1) { + "12456ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:L:NPR:TVX")) != -1) { switch (opt) { case '1': options.protocol = SSH_PROTO_1; @@ -275,6 +276,9 @@ case '4': options.address_family = AF_INET; break; + case '5': + options.address_family = AF_LLC; + break; case '6': options.address_family = AF_INET6; break; diff -uNr openssh-3.7.1p2.orig/sshconnect.c openssh-3.7.1p2.llc/sshconnect.c --- openssh-3.7.1p2.orig/sshconnect.c 2003-09-23 05:49:29.000000000 -0300 +++ openssh-3.7.1p2.llc/sshconnect.c 2003-11-06 12:09:54.000000000 -0200 @@ -205,7 +205,7 @@ hints.ai_socktype = ai->ai_socktype; hints.ai_protocol = ai->ai_protocol; hints.ai_flags = AI_PASSIVE; - gaierr = getaddrinfo(options.bind_address, "0", &hints, &res); + gaierr = mygetaddrinfo(options.bind_address, "0", &hints, &res); if (gaierr) { error("getaddrinfo: %s: %s", options.bind_address, gai_strerror(gaierr)); @@ -345,7 +345,7 @@ hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; snprintf(strport, sizeof strport, "%u", port); - if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) + if ((gaierr = mygetaddrinfo(host, strport, &hints, &aitop)) != 0) fatal("%s: %.100s: %s", __progname, host, gai_strerror(gaierr)); @@ -361,9 +361,11 @@ /* Loop through addresses for this host, and try each one in sequence until the connection succeeds. */ for (ai = aitop; ai; ai = ai->ai_next) { - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) + if (ai->ai_family != AF_INET && + ai->ai_family != AF_INET6 && + ai->ai_family != AF_LLC) continue; - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, + if (mygetnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV) != 0) { error("ssh_connect: getnameinfo failed"); @@ -615,7 +617,7 @@ * using a proxy command */ if (options.proxy_command == NULL) { - if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop), + if (mygetnameinfo(hostaddr, salen, ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST) != 0) fatal("check_host_key: getnameinfo failed"); ip = xstrdup(ntop); diff -uNr openssh-3.7.1p2.orig/sshd.c openssh-3.7.1p2.llc/sshd.c --- openssh-3.7.1p2.orig/sshd.c 2003-09-02 09:51:17.000000000 -0300 +++ openssh-3.7.1p2.llc/sshd.c 2003-11-06 12:19:49.000000000 -0200 @@ -786,6 +786,7 @@ _PATH_HOST_KEY_FILE); fprintf(stderr, " -u len Maximum hostname length for utmp recording\n"); fprintf(stderr, " -4 Use IPv4 only\n"); + fprintf(stderr, " -5 Use LLC only\n"); fprintf(stderr, " -6 Use IPv6 only\n"); fprintf(stderr, " -o option Process the option as if it was read from a configuration file.\n"); exit(1); @@ -839,11 +840,14 @@ initialize_server_options(&options); /* Parse command-line arguments. */ - while ((opt = getopt(ac, av, "f:p:b:k:h:g:u:o:dDeiqtQ46")) != -1) { + while ((opt = getopt(ac, av, "f:p:b:k:h:g:u:o:dDeiqtQ456")) != -1) { switch (opt) { case '4': IPv4or6 = AF_INET; break; + case '5': + IPv4or6 = AF_LLC; + break; case '6': IPv4or6 = AF_INET6; break; @@ -1128,12 +1132,14 @@ generate_ephemeral_server_key(); } else { for (ai = options.listen_addrs; ai; ai = ai->ai_next) { - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) + if (ai->ai_family != AF_INET && + ai->ai_family != AF_INET6 && + ai->ai_family != AF_LLC) continue; if (num_listen_socks >= MAX_LISTEN_SOCKS) fatal("Too many listen sockets. " "Enlarge MAX_LISTEN_SOCKS"); - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, + if (mygetnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV) != 0) { error("getnameinfo failed");