netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: Jan Oravec <jan.oravec@6com.sk>
Cc: yoshfuji@linux-ipv6.org, netdev@oss.sgi.com
Subject: Re: problem setting net.ipvX.conf.all.forwarding via sysctl() system call
Date: Sat, 9 Aug 2003 01:06:06 -0700	[thread overview]
Message-ID: <20030809010606.6cfce75c.davem@redhat.com> (raw)
In-Reply-To: <20030808091124.GA17961@wsx.ksp.sk>

On Fri, 8 Aug 2003 11:11:24 +0200
Jan Oravec <jan.oravec@6com.sk> wrote:

> this is a new patch
 ...
> +	ipv4_devconf.forwarding = new;
>  	inet_forward_change();
> -	return 1;
> +	return 0;

This is still wrong.

First of all we have the table->data pointer in "valp"
so let's use that to set the value.  In this way we can
use this function for other sysctl values if we ever desire
to do that.

Second, if we set the table->data value, we must return > 0.
This tells the caller that we've done the sysctl value update.
If we return zero, it would update the value a second time.

Here is the fix I'm going to use.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1136  -> 1.1137 
#	net/ipv4/sysctl_net_ipv4.c	1.11    -> 1.12   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/08/09	davem@nuts.ninka.net	1.1137
# [IPV4]: Fix setting net.ipv4.conf.all.forwarding via sysctl() system call.
# --------------------------------------------
#
diff -Nru a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
--- a/net/ipv4/sysctl_net_ipv4.c	Sat Aug  9 01:02:17 2003
+++ b/net/ipv4/sysctl_net_ipv4.c	Sat Aug  9 01:02:17 2003
@@ -109,6 +109,7 @@
 		}
 	}
 
+	*valp = new;
 	inet_forward_change();
 	return 1;
 }

  reply	other threads:[~2003-08-09  8:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-03 15:44 problem setting net.ipvX.conf.all.forwarding via sysctl() system call Jan Oravec
2003-08-08  8:45 ` YOSHIFUJI Hideaki / 吉藤英明
2003-08-08  9:11   ` Jan Oravec
2003-08-09  8:06     ` David S. Miller [this message]
2003-08-08  8:50 ` [PATCH] IPV6: strategy hander for net.ipv6.conf.*.forwarding (is Re: problem setting net.ipvX.conf.all.forwarding via sysctl() system call) YOSHIFUJI Hideaki / 吉藤英明
2003-08-08  9:37   ` Jan Oravec
2003-08-08  9:51     ` YOSHIFUJI Hideaki / 吉藤英明
2003-08-08 11:39       ` Jan Oravec
2003-08-09  8:08       ` David S. Miller
2003-08-09 10:21         ` YOSHIFUJI Hideaki / 吉藤英明
2003-08-09 21:44           ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030809010606.6cfce75c.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=jan.oravec@6com.sk \
    --cc=netdev@oss.sgi.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).