Re: [PATCH] alignment issue with ipchains

From: NIIBE Yutaka (gniibe@chroot.org)
Date: Sat Sep 09 2000 - 01:03:27 EST


David S. Miller wrote:
> Could you send me a patch which fixes the problem in this way?

Sure. Here is the one. The occurrence of the IP_XXX corresponds the
one in switch/case.

Thank you for your time,

--- linux-2.4.0-test8-pre6/net/ipv4/ip_sockglue.c Fri Aug 11 05:01:26 2000
+++ linux/net/ipv4/ip_sockglue.c Sat Sep 9 14:42:25 2000
@@ -380,15 +380,22 @@ int ip_setsockopt(struct sock *sk, int l
 {
         int val=0,err;
 
- if(optlen>=sizeof(int)) {
- if(get_user(val, (int *) optval))
- return -EFAULT;
- } else if(optlen>=sizeof(char)) {
- unsigned char ucval;
- if(get_user(ucval, (unsigned char *) optval))
- return -EFAULT;
- val = (int)ucval;
- }
+ if (optname == IP_PKTINFO || optname == IP_RECVTTL
+ || optname == IP_RECVTOS || optname == IP_RECVOPTS
+ || optname == IP_RETOPTS || optname == IP_TOS
+ || optname == IP_TTL || optname == IP_HDRINCL
+ || optname == IP_MTU_DISCOVER || optname == IP_RECVERR
+ || optname == IP_MULTICAST_TTL || optname == IP_MULTICAST_LOOP
+ || optname == IP_ROUTER_ALERT)
+ if(optlen>=sizeof(int)) {
+ if(get_user(val, (int *) optval))
+ return -EFAULT;
+ } else if(optlen>=sizeof(char)) {
+ unsigned char ucval;
+ if(get_user(ucval, (unsigned char *) optval))
+ return -EFAULT;
+ val = (int)ucval;
+ }
         /* If optlen==0, it is equivalent to val == 0 */
         
         if(level!=SOL_IP)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 15 2000 - 21:00:11 EST