mirror of /home/gitosis/repositories/libowfat.git
parent
d18386fb74
commit
cc26b4b5bb
9 changed files with 115 additions and 23 deletions
@ -1,9 +1,33 @@ |
||||
#include <sys/types.h> |
||||
#include <sys/socket.h> |
||||
#include <netinet/in.h> |
||||
|
||||
#include <errno.h> |
||||
#include "haveip6.h" |
||||
#include "socket.h" |
||||
|
||||
int socket_tcp6(void) { |
||||
return socket(PF_INET6,SOCK_STREAM,IPPROTO_TCP); |
||||
#ifndef EAFNOSUPPORT |
||||
#define EAFNOSUPPORT EINVAL |
||||
#endif |
||||
|
||||
int socket_tcp6(void) |
||||
{ |
||||
#ifdef LIBC_HAS_IP6 |
||||
int s; |
||||
|
||||
if (noipv6) goto compat; |
||||
s = socket(PF_INET6,SOCK_STREAM,0); |
||||
if (s == -1) { |
||||
if (errno == EINVAL || errno == EAFNOSUPPORT) { |
||||
compat: |
||||
s=socket(AF_INET,SOCK_STREAM,0); |
||||
noipv6=1; |
||||
if (s==-1) return -1; |
||||
} else |
||||
return -1; |
||||
} |
||||
return s; |
||||
#else |
||||
return socket_tcp(); |
||||
#endif |
||||
} |
||||
|
||||
|
@ -1,9 +1,32 @@ |
||||
#include <sys/types.h> |
||||
#include <sys/socket.h> |
||||
#include <netinet/in.h> |
||||
|
||||
#include <errno.h> |
||||
#include "haveip6.h" |
||||
#include "socket.h" |
||||
|
||||
int socket_udp6(void) { |
||||
return socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP); |
||||
#ifndef EAFNOSUPPORT |
||||
#define EAFNOSUPPORT EINVAL |
||||
#endif |
||||
|
||||
int socket_udp6(void) |
||||
{ |
||||
#ifdef LIBC_HAS_IP6 |
||||
int s; |
||||
|
||||
if (noipv6) goto compat; |
||||
s = socket(PF_INET6,SOCK_DGRAM,0); |
||||
if (s == -1) { |
||||
if (errno == EINVAL || errno == EAFNOSUPPORT) { |
||||
compat: |
||||
s=socket(AF_INET,SOCK_DGRAM,0); |
||||
noipv6=1; |
||||
if (s==-1) return -1; |
||||
} else |
||||
return -1; |
||||
} |
||||
return s; |
||||
#else |
||||
return socket_udp(); |
||||
#endif |
||||
} |
||||
|
@ -0,0 +1,8 @@ |
||||
#include <sys/types.h> |
||||
#include <sys/socket.h> |
||||
#include <netinet/in.h> |
||||
|
||||
main() { |
||||
struct sockaddr_in6 sa; |
||||
sa.sin6_family = PF_INET6; |
||||
} |
@ -0,0 +1,8 @@ |
||||
#include <sys/types.h> |
||||
#include <sys/socket.h> |
||||
#include <net/if.h> |
||||
|
||||
int main() { |
||||
static char ifname[IFNAMSIZ]; |
||||
char *tmp=if_indextoname(0,ifname); |
||||
} |
Loading…
Reference in new issue