Convert IP socket options.

This commit is contained in:
mycroft 1995-05-28 08:50:17 +00:00
parent fbc3ef234b
commit e89504670f
9 changed files with 328 additions and 91 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.h,v 1.1 1995/02/28 23:26:03 fvdl Exp $ */
/* $NetBSD: linux_socket.h,v 1.2 1995/05/28 08:50:19 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -90,7 +90,12 @@
* currently implemented in Linux
*/
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_MULTICAST_IF 32
#define LINUX_IP_MULTICAST_TTL 33
#define LINUX_IP_MULTICAST_LOOP 34
#define LINUX_IP_ADD_MEMBERSHIP 35
#define LINUX_IP_DROP_MEMBERSHIP 36
#endif /* _LINUX_SOCKET_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.c,v 1.2 1995/05/28 08:09:51 mycroft Exp $ */
/* $NetBSD: linux_socket.c,v 1.3 1995/05/28 08:50:17 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -428,24 +428,12 @@ linux_to_bsd_sopt_level(llevel)
switch (llevel) {
case LINUX_SOL_SOCKET:
return SOL_SOCKET;
default:
return llevel;
}
}
/*
* Convert Linux IP level socket option number to NetBSD values.
* Linux only implements IP_TOS and IP_TTL
*/
int
linux_to_bsd_ip_sockopt(lopt)
int lopt;
{
switch (lopt) {
case LINUX_IP_TOS:
return IP_TOS;
case LINUX_IP_TTL:
return IP_TTL;
case LINUX_SOL_IP:
return IPPROTO_IP;
case LINUX_SOL_TCP:
return IPPROTO_TCP;
case LINUX_SOL_UDP:
return IPPROTO_UDP;
default:
return -1;
}
@ -488,6 +476,59 @@ linux_to_bsd_so_sockopt(lopt)
}
}
/*
* Convert Linux IP level socket option number to NetBSD values.
*/
int
linux_to_bsd_ip_sockopt(lopt)
int lopt;
{
switch (lopt) {
case LINUX_IP_TOS:
return IP_TOS;
case LINUX_IP_TTL:
return IP_TTL;
case LINUX_IP_MULTICAST_TTL:
return IP_MULTICAST_TTL;
case LINUX_IP_MULTICAST_LOOP:
return IP_MULTICAST_LOOP;
case LINUX_IP_MULTICAST_IF:
return IP_MULTICAST_IF;
case LINUX_IP_ADD_MEMBERSHIP:
return IP_ADD_MEMBERSHIP;
case LINUX_IP_DROP_MEMBERSHIP:
return IP_DROP_MEMBERSHIP;
default:
return -1;
}
}
/*
* Convert Linux TCP level socket option number to NetBSD values.
*/
int
linux_to_bsd_tcp_sockopt(lopt)
int lopt;
{
switch (lopt) {
default:
return linux_to_bsd_ip_sockopt(lopt);
}
}
/*
* Convert Linux UDP level socket option number to NetBSD values.
*/
int
linux_to_bsd_udp_sockopt(lopt)
int lopt;
{
switch (lopt) {
default:
return linux_to_bsd_ip_sockopt(lopt);
}
}
/*
* Another reasonably straightforward function: setsockopt(2). Only
* the SOL_SOCKET and IPPROTO_IP levels are implemented here.
@ -525,6 +566,12 @@ linux_setsockopt(p, args, retval)
case IPPROTO_IP:
name = linux_to_bsd_ip_sockopt(lsa.optname);
break;
case IPPROTO_TCP:
name = linux_to_bsd_tcp_sockopt(lsa.optname);
break;
case IPPROTO_UDP:
name = linux_to_bsd_udp_sockopt(lsa.optname);
break;
default:
return EINVAL;
}
@ -571,6 +618,12 @@ linux_getsockopt(p, args, retval)
case IPPROTO_IP:
name = linux_to_bsd_ip_sockopt(lga.optname);
break;
case IPPROTO_TCP:
name = linux_to_bsd_tcp_sockopt(lsa.optname);
break;
case IPPROTO_UDP:
name = linux_to_bsd_udp_sockopt(lsa.optname);
break;
default:
return EINVAL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.h,v 1.1 1995/02/28 23:26:03 fvdl Exp $ */
/* $NetBSD: linux_socket.h,v 1.2 1995/05/28 08:50:19 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -90,7 +90,12 @@
* currently implemented in Linux
*/
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_MULTICAST_IF 32
#define LINUX_IP_MULTICAST_TTL 33
#define LINUX_IP_MULTICAST_LOOP 34
#define LINUX_IP_ADD_MEMBERSHIP 35
#define LINUX_IP_DROP_MEMBERSHIP 36
#endif /* _LINUX_SOCKET_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socketcall.c,v 1.2 1995/05/28 08:09:51 mycroft Exp $ */
/* $NetBSD: linux_socketcall.c,v 1.3 1995/05/28 08:50:17 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -428,24 +428,12 @@ linux_to_bsd_sopt_level(llevel)
switch (llevel) {
case LINUX_SOL_SOCKET:
return SOL_SOCKET;
default:
return llevel;
}
}
/*
* Convert Linux IP level socket option number to NetBSD values.
* Linux only implements IP_TOS and IP_TTL
*/
int
linux_to_bsd_ip_sockopt(lopt)
int lopt;
{
switch (lopt) {
case LINUX_IP_TOS:
return IP_TOS;
case LINUX_IP_TTL:
return IP_TTL;
case LINUX_SOL_IP:
return IPPROTO_IP;
case LINUX_SOL_TCP:
return IPPROTO_TCP;
case LINUX_SOL_UDP:
return IPPROTO_UDP;
default:
return -1;
}
@ -488,6 +476,59 @@ linux_to_bsd_so_sockopt(lopt)
}
}
/*
* Convert Linux IP level socket option number to NetBSD values.
*/
int
linux_to_bsd_ip_sockopt(lopt)
int lopt;
{
switch (lopt) {
case LINUX_IP_TOS:
return IP_TOS;
case LINUX_IP_TTL:
return IP_TTL;
case LINUX_IP_MULTICAST_TTL:
return IP_MULTICAST_TTL;
case LINUX_IP_MULTICAST_LOOP:
return IP_MULTICAST_LOOP;
case LINUX_IP_MULTICAST_IF:
return IP_MULTICAST_IF;
case LINUX_IP_ADD_MEMBERSHIP:
return IP_ADD_MEMBERSHIP;
case LINUX_IP_DROP_MEMBERSHIP:
return IP_DROP_MEMBERSHIP;
default:
return -1;
}
}
/*
* Convert Linux TCP level socket option number to NetBSD values.
*/
int
linux_to_bsd_tcp_sockopt(lopt)
int lopt;
{
switch (lopt) {
default:
return linux_to_bsd_ip_sockopt(lopt);
}
}
/*
* Convert Linux UDP level socket option number to NetBSD values.
*/
int
linux_to_bsd_udp_sockopt(lopt)
int lopt;
{
switch (lopt) {
default:
return linux_to_bsd_ip_sockopt(lopt);
}
}
/*
* Another reasonably straightforward function: setsockopt(2). Only
* the SOL_SOCKET and IPPROTO_IP levels are implemented here.
@ -525,6 +566,12 @@ linux_setsockopt(p, args, retval)
case IPPROTO_IP:
name = linux_to_bsd_ip_sockopt(lsa.optname);
break;
case IPPROTO_TCP:
name = linux_to_bsd_tcp_sockopt(lsa.optname);
break;
case IPPROTO_UDP:
name = linux_to_bsd_udp_sockopt(lsa.optname);
break;
default:
return EINVAL;
}
@ -571,6 +618,12 @@ linux_getsockopt(p, args, retval)
case IPPROTO_IP:
name = linux_to_bsd_ip_sockopt(lga.optname);
break;
case IPPROTO_TCP:
name = linux_to_bsd_tcp_sockopt(lsa.optname);
break;
case IPPROTO_UDP:
name = linux_to_bsd_udp_sockopt(lsa.optname);
break;
default:
return EINVAL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.h,v 1.1 1995/02/28 23:26:03 fvdl Exp $ */
/* $NetBSD: linux_socket.h,v 1.2 1995/05/28 08:50:19 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -90,7 +90,12 @@
* currently implemented in Linux
*/
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_MULTICAST_IF 32
#define LINUX_IP_MULTICAST_TTL 33
#define LINUX_IP_MULTICAST_LOOP 34
#define LINUX_IP_ADD_MEMBERSHIP 35
#define LINUX_IP_DROP_MEMBERSHIP 36
#endif /* _LINUX_SOCKET_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.h,v 1.1 1995/02/28 23:26:03 fvdl Exp $ */
/* $NetBSD: linux_socket.h,v 1.2 1995/05/28 08:50:19 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -90,7 +90,12 @@
* currently implemented in Linux
*/
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_MULTICAST_IF 32
#define LINUX_IP_MULTICAST_TTL 33
#define LINUX_IP_MULTICAST_LOOP 34
#define LINUX_IP_ADD_MEMBERSHIP 35
#define LINUX_IP_DROP_MEMBERSHIP 36
#endif /* _LINUX_SOCKET_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.c,v 1.2 1995/05/28 08:09:51 mycroft Exp $ */
/* $NetBSD: linux_socket.c,v 1.3 1995/05/28 08:50:17 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -428,24 +428,12 @@ linux_to_bsd_sopt_level(llevel)
switch (llevel) {
case LINUX_SOL_SOCKET:
return SOL_SOCKET;
default:
return llevel;
}
}
/*
* Convert Linux IP level socket option number to NetBSD values.
* Linux only implements IP_TOS and IP_TTL
*/
int
linux_to_bsd_ip_sockopt(lopt)
int lopt;
{
switch (lopt) {
case LINUX_IP_TOS:
return IP_TOS;
case LINUX_IP_TTL:
return IP_TTL;
case LINUX_SOL_IP:
return IPPROTO_IP;
case LINUX_SOL_TCP:
return IPPROTO_TCP;
case LINUX_SOL_UDP:
return IPPROTO_UDP;
default:
return -1;
}
@ -488,6 +476,59 @@ linux_to_bsd_so_sockopt(lopt)
}
}
/*
* Convert Linux IP level socket option number to NetBSD values.
*/
int
linux_to_bsd_ip_sockopt(lopt)
int lopt;
{
switch (lopt) {
case LINUX_IP_TOS:
return IP_TOS;
case LINUX_IP_TTL:
return IP_TTL;
case LINUX_IP_MULTICAST_TTL:
return IP_MULTICAST_TTL;
case LINUX_IP_MULTICAST_LOOP:
return IP_MULTICAST_LOOP;
case LINUX_IP_MULTICAST_IF:
return IP_MULTICAST_IF;
case LINUX_IP_ADD_MEMBERSHIP:
return IP_ADD_MEMBERSHIP;
case LINUX_IP_DROP_MEMBERSHIP:
return IP_DROP_MEMBERSHIP;
default:
return -1;
}
}
/*
* Convert Linux TCP level socket option number to NetBSD values.
*/
int
linux_to_bsd_tcp_sockopt(lopt)
int lopt;
{
switch (lopt) {
default:
return linux_to_bsd_ip_sockopt(lopt);
}
}
/*
* Convert Linux UDP level socket option number to NetBSD values.
*/
int
linux_to_bsd_udp_sockopt(lopt)
int lopt;
{
switch (lopt) {
default:
return linux_to_bsd_ip_sockopt(lopt);
}
}
/*
* Another reasonably straightforward function: setsockopt(2). Only
* the SOL_SOCKET and IPPROTO_IP levels are implemented here.
@ -525,6 +566,12 @@ linux_setsockopt(p, args, retval)
case IPPROTO_IP:
name = linux_to_bsd_ip_sockopt(lsa.optname);
break;
case IPPROTO_TCP:
name = linux_to_bsd_tcp_sockopt(lsa.optname);
break;
case IPPROTO_UDP:
name = linux_to_bsd_udp_sockopt(lsa.optname);
break;
default:
return EINVAL;
}
@ -571,6 +618,12 @@ linux_getsockopt(p, args, retval)
case IPPROTO_IP:
name = linux_to_bsd_ip_sockopt(lga.optname);
break;
case IPPROTO_TCP:
name = linux_to_bsd_tcp_sockopt(lsa.optname);
break;
case IPPROTO_UDP:
name = linux_to_bsd_udp_sockopt(lsa.optname);
break;
default:
return EINVAL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.h,v 1.1 1995/02/28 23:26:03 fvdl Exp $ */
/* $NetBSD: linux_socket.h,v 1.2 1995/05/28 08:50:19 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -90,7 +90,12 @@
* currently implemented in Linux
*/
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
#define LINUX_IP_MULTICAST_IF 32
#define LINUX_IP_MULTICAST_TTL 33
#define LINUX_IP_MULTICAST_LOOP 34
#define LINUX_IP_ADD_MEMBERSHIP 35
#define LINUX_IP_DROP_MEMBERSHIP 36
#endif /* _LINUX_SOCKET_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socketcall.c,v 1.2 1995/05/28 08:09:51 mycroft Exp $ */
/* $NetBSD: linux_socketcall.c,v 1.3 1995/05/28 08:50:17 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -428,24 +428,12 @@ linux_to_bsd_sopt_level(llevel)
switch (llevel) {
case LINUX_SOL_SOCKET:
return SOL_SOCKET;
default:
return llevel;
}
}
/*
* Convert Linux IP level socket option number to NetBSD values.
* Linux only implements IP_TOS and IP_TTL
*/
int
linux_to_bsd_ip_sockopt(lopt)
int lopt;
{
switch (lopt) {
case LINUX_IP_TOS:
return IP_TOS;
case LINUX_IP_TTL:
return IP_TTL;
case LINUX_SOL_IP:
return IPPROTO_IP;
case LINUX_SOL_TCP:
return IPPROTO_TCP;
case LINUX_SOL_UDP:
return IPPROTO_UDP;
default:
return -1;
}
@ -488,6 +476,59 @@ linux_to_bsd_so_sockopt(lopt)
}
}
/*
* Convert Linux IP level socket option number to NetBSD values.
*/
int
linux_to_bsd_ip_sockopt(lopt)
int lopt;
{
switch (lopt) {
case LINUX_IP_TOS:
return IP_TOS;
case LINUX_IP_TTL:
return IP_TTL;
case LINUX_IP_MULTICAST_TTL:
return IP_MULTICAST_TTL;
case LINUX_IP_MULTICAST_LOOP:
return IP_MULTICAST_LOOP;
case LINUX_IP_MULTICAST_IF:
return IP_MULTICAST_IF;
case LINUX_IP_ADD_MEMBERSHIP:
return IP_ADD_MEMBERSHIP;
case LINUX_IP_DROP_MEMBERSHIP:
return IP_DROP_MEMBERSHIP;
default:
return -1;
}
}
/*
* Convert Linux TCP level socket option number to NetBSD values.
*/
int
linux_to_bsd_tcp_sockopt(lopt)
int lopt;
{
switch (lopt) {
default:
return linux_to_bsd_ip_sockopt(lopt);
}
}
/*
* Convert Linux UDP level socket option number to NetBSD values.
*/
int
linux_to_bsd_udp_sockopt(lopt)
int lopt;
{
switch (lopt) {
default:
return linux_to_bsd_ip_sockopt(lopt);
}
}
/*
* Another reasonably straightforward function: setsockopt(2). Only
* the SOL_SOCKET and IPPROTO_IP levels are implemented here.
@ -525,6 +566,12 @@ linux_setsockopt(p, args, retval)
case IPPROTO_IP:
name = linux_to_bsd_ip_sockopt(lsa.optname);
break;
case IPPROTO_TCP:
name = linux_to_bsd_tcp_sockopt(lsa.optname);
break;
case IPPROTO_UDP:
name = linux_to_bsd_udp_sockopt(lsa.optname);
break;
default:
return EINVAL;
}
@ -571,6 +618,12 @@ linux_getsockopt(p, args, retval)
case IPPROTO_IP:
name = linux_to_bsd_ip_sockopt(lga.optname);
break;
case IPPROTO_TCP:
name = linux_to_bsd_tcp_sockopt(lsa.optname);
break;
case IPPROTO_UDP:
name = linux_to_bsd_udp_sockopt(lsa.optname);
break;
default:
return EINVAL;
}