/* Set up address hint structure */
memset(&hints, 0, sizeof(hints));
hints.ai_family = l3type;
- /* getaddrinfo does not really work well with SOCK_DCCP */
- if (socktype == SOCK_DGRAM || socktype == SOCK_STREAM)
- hints.ai_socktype = socktype;
+ hints.ai_socktype = socktype;
+ /*
+ * getaddrinfo does not support SOCK_DCCP, so for the sake of lookup
+ * (and only then) pretend to be UDP.
+ */
+ if (l4type == IPPROTO_DCCP)
+ hints.ai_socktype = SOCK_DGRAM;
/* only use addresses available on the host */
hints.ai_flags = AI_ADDRCONFIG;