summaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-05-14 17:33:37 +0000
committerUlrich Drepper <drepper@redhat.com>2008-05-14 17:33:37 +0000
commit372bfcac7303b226cfb376ff6a4bdda0eab09419 (patch)
tree7e819f7786f598282619ff068bc8b1d46ca2f4ba /sysdeps/posix
parentf05ac8f5030a8173b4eec5d73505cfd81d415a96 (diff)
* sysdeps/posix/getaddrinfo.c: Implement handling of DCCP and
UDPlite. * nss/getent.c (ahosts_keys_int): Handle all known socket types. * inet/netinet/in.h (IPPIPPROTO_DCCP, IPPROTO_UDPLITE): Define. * sysdeps/unix/sysv/linux/bits/socket.h (SOCK_DCCP): Define.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 3de83e3948..7548ddf6f0 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -97,8 +97,9 @@ struct gaih_typeproto
{
int socktype;
int protocol;
- char name[4];
- int protoflag;
+ uint8_t protoflag;
+ bool defaultflag;
+ char name[8];
};
/* Values for `protoflag'. */
@@ -107,11 +108,17 @@ struct gaih_typeproto
static const struct gaih_typeproto gaih_inet_typeproto[] =
{
- { 0, 0, "", 0 },
- { SOCK_STREAM, IPPROTO_TCP, "tcp", 0 },
- { SOCK_DGRAM, IPPROTO_UDP, "udp", 0 },
- { SOCK_RAW, 0, "raw", GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE },
- { 0, 0, "", 0 }
+ { 0, 0, 0, false, "" },
+ { SOCK_STREAM, IPPROTO_TCP, 0, true, "tcp" },
+ { SOCK_DGRAM, IPPROTO_UDP, 0, true, "udp" },
+#if defined SOCK_DCCP && defined IPPROTO_DCCP
+ { SOCK_DCCP, IPPROTO_DCCP, 0, false, "dccp" },
+#endif
+#ifdef IPPROTO_UDPLITE
+ { SOCK_DGRAM, IPPROTO_UDPLITE, 0, false, "udplite" },
+#endif
+ { SOCK_RAW, 0, GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE, true, "raw" },
+ { 0, 0, 0, false, "" }
};
struct gaih
@@ -363,18 +370,19 @@ gaih_inet (const char *name, const struct gaih_service *service,
we know about. */
struct gaih_servtuple **lastp = &st;
for (++tp; tp->name[0]; ++tp)
- {
- struct gaih_servtuple *newp;
+ if (tp->defaultflag)
+ {
+ struct gaih_servtuple *newp;
- newp = __alloca (sizeof (struct gaih_servtuple));
- newp->next = NULL;
- newp->socktype = tp->socktype;
- newp->protocol = tp->protocol;
- newp->port = port;
+ newp = __alloca (sizeof (struct gaih_servtuple));
+ newp->next = NULL;
+ newp->socktype = tp->socktype;
+ newp->protocol = tp->protocol;
+ newp->port = port;
- *lastp = newp;
- lastp = &newp->next;
- }
+ *lastp = newp;
+ lastp = &newp->next;
+ }
}
}