diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-08-25 09:12:35 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-08-25 09:12:35 +0000 |
commit | c7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch) | |
tree | 3682407a599b8f9f03fc096298134cafba1c9b2f /net/ipv4/ip_sockglue.c | |
parent | 1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff) |
o Merge with Linux 2.1.116.
o New Newport console code.
o New G364 console code.
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r-- | net/ipv4/ip_sockglue.c | 66 |
1 files changed, 18 insertions, 48 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index b31a1d3a0..8f712c801 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -5,7 +5,7 @@ * * The IP to API glue. * - * Version: $Id: ip_sockglue.c,v 1.5 1998/03/17 22:18:29 ralf Exp $ + * Version: $Id: ip_sockglue.c,v 1.36 1998/07/15 05:05:06 davem Exp $ * * Authors: see ip.c * @@ -39,6 +39,8 @@ #include <asm/uaccess.h> +#define MAX(a,b) ((a)>(b)?(a):(b)) + #define IP_CMSG_PKTINFO 1 #define IP_CMSG_TTL 2 #define IP_CMSG_TOS 4 @@ -68,17 +70,11 @@ static void ip_cmsg_recv_pktinfo(struct msghdr *msg, struct sk_buff *skb) static void ip_cmsg_recv_ttl(struct msghdr *msg, struct sk_buff *skb) { - if (IPCB(skb)->opt.optlen == 0) - return; - put_cmsg(msg, SOL_IP, IP_TTL, 1, &skb->nh.iph->ttl); } static void ip_cmsg_recv_tos(struct msghdr *msg, struct sk_buff *skb) { - if (IPCB(skb)->opt.optlen == 0) - return; - put_cmsg(msg, SOL_IP, IP_TOS, 1, &skb->nh.iph->tos); } @@ -227,8 +223,8 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen) { int val=0,err; -#if defined(CONFIG_IP_FIREWALL) || defined(CONFIG_IP_ACCT) - struct ip_fw tmp_fw; +#if defined(CONFIG_IP_FIREWALL) + char tmp_fw[MAX(sizeof(struct ip_fwtest),sizeof(struct ip_fwnew))]; #endif #ifdef CONFIG_IP_MASQUERADE char masq_ctl[IP_FW_MASQCTL_MAX]; @@ -387,7 +383,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int opt } if (!mreq.imr_ifindex) { - if (!mreq.imr_address.s_addr == INADDR_ANY) { + if (mreq.imr_address.s_addr == INADDR_ANY) { sk->ip_mc_index = 0; sk->ip_mc_addr = 0; return 0; @@ -432,28 +428,18 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int opt return ip_ra_control(sk, val ? 1 : 0, NULL); #ifdef CONFIG_IP_FIREWALL - case IP_FW_INSERT_IN: - case IP_FW_INSERT_OUT: - case IP_FW_INSERT_FWD: - case IP_FW_APPEND_IN: - case IP_FW_APPEND_OUT: - case IP_FW_APPEND_FWD: - case IP_FW_DELETE_IN: - case IP_FW_DELETE_OUT: - case IP_FW_DELETE_FWD: - case IP_FW_CHECK_IN: - case IP_FW_CHECK_OUT: - case IP_FW_CHECK_FWD: - case IP_FW_FLUSH_IN: - case IP_FW_FLUSH_OUT: - case IP_FW_FLUSH_FWD: - case IP_FW_ZERO_IN: - case IP_FW_ZERO_OUT: - case IP_FW_ZERO_FWD: - case IP_FW_POLICY_IN: - case IP_FW_POLICY_OUT: - case IP_FW_POLICY_FWD: case IP_FW_MASQ_TIMEOUTS: + case IP_FW_APPEND: + case IP_FW_REPLACE: + case IP_FW_DELETE: + case IP_FW_DELETE_NUM: + case IP_FW_INSERT: + case IP_FW_FLUSH: + case IP_FW_ZERO: + case IP_FW_CHECK: + case IP_FW_CREATECHAIN: + case IP_FW_DELETECHAIN: + case IP_FW_POLICY: if(!capable(CAP_NET_ADMIN)) return -EACCES; if(optlen>sizeof(tmp_fw) || optlen<1) @@ -462,8 +448,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int opt return -EFAULT; err=ip_fw_ctl(optname, &tmp_fw,optlen); return -err; /* -0 is 0 after all */ - -#endif +#endif /* CONFIG_IP_FIREWALL */ #ifdef CONFIG_IP_MASQUERADE case IP_FW_MASQ_ADD: case IP_FW_MASQ_DEL: @@ -478,21 +463,6 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int opt return -err; /* -0 is 0 after all */ #endif -#ifdef CONFIG_IP_ACCT - case IP_ACCT_INSERT: - case IP_ACCT_APPEND: - case IP_ACCT_DELETE: - case IP_ACCT_FLUSH: - case IP_ACCT_ZERO: - if(!capable(CAP_NET_ADMIN)) - return -EACCES; - if(optlen>sizeof(tmp_fw) || optlen<1) - return -EINVAL; - if(copy_from_user(&tmp_fw, optval,optlen)) - return -EFAULT; - err=ip_acct_ctl(optname, &tmp_fw,optlen); - return -err; /* -0 is 0 after all */ -#endif default: return(-ENOPROTOOPT); } |