Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
0499eb10
Commit
0499eb10
authored
Mar 25, 2003
by
Alexey Kuznetsov
Committed by
David S. Miller
Mar 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV4]: Make sure rtcache flush happens after sysctl updates.
parent
07c90427
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
7 deletions
+90
-7
net/ipv4/devinet.c
net/ipv4/devinet.c
+60
-2
net/ipv4/sysctl_net_ipv4.c
net/ipv4/sysctl_net_ipv4.c
+30
-5
No files found.
net/ipv4/devinet.c
View file @
0499eb10
...
...
@@ -1065,6 +1065,62 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
return
ret
;
}
static
int
ipv4_doint_and_flush
(
ctl_table
*
ctl
,
int
write
,
struct
file
*
filp
,
void
*
buffer
,
size_t
*
lenp
)
{
int
*
valp
=
ctl
->
data
;
int
val
=
*
valp
;
int
ret
=
proc_dointvec
(
ctl
,
write
,
filp
,
buffer
,
lenp
);
if
(
write
&&
*
valp
!=
val
)
rt_cache_flush
(
0
);
return
ret
;
}
static
int
ipv4_doint_and_flush_strategy
(
ctl_table
*
table
,
int
*
name
,
int
nlen
,
void
*
oldval
,
size_t
*
oldlenp
,
void
*
newval
,
size_t
newlen
,
void
**
context
)
{
int
*
valp
=
table
->
data
;
int
new
;
if
(
!
newval
||
!
newlen
)
return
0
;
if
(
newlen
!=
sizeof
(
int
))
return
-
EINVAL
;
if
(
get_user
(
new
,
(
int
*
)
newval
))
return
-
EFAULT
;
if
(
new
==
*
valp
)
return
0
;
if
(
oldval
&&
oldlenp
)
{
size_t
len
;
if
(
get_user
(
len
,
oldlenp
))
return
-
EFAULT
;
if
(
len
)
{
if
(
len
>
table
->
maxlen
)
len
=
table
->
maxlen
;
if
(
copy_to_user
(
oldval
,
valp
,
len
))
return
-
EFAULT
;
if
(
put_user
(
len
,
oldlenp
))
return
-
EFAULT
;
}
}
*
valp
=
new
;
rt_cache_flush
(
0
);
return
1
;
}
static
struct
devinet_sysctl_table
{
struct
ctl_table_header
*
sysctl_header
;
ctl_table
devinet_vars
[
17
];
...
...
@@ -1192,7 +1248,8 @@ static struct devinet_sysctl_table {
.
data
=
&
ipv4_devconf
.
no_xfrm
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=&
proc_dointvec
,
.
proc_handler
=
&
ipv4_doint_and_flush
,
.
strategy
=
&
ipv4_doint_and_flush_strategy
,
},
{
.
ctl_name
=
NET_IPV4_CONF_NOPOLICY
,
...
...
@@ -1200,7 +1257,8 @@ static struct devinet_sysctl_table {
.
data
=
&
ipv4_devconf
.
no_policy
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=&
proc_dointvec
,
.
proc_handler
=
&
ipv4_doint_and_flush
,
.
strategy
=
&
ipv4_doint_and_flush_strategy
,
},
},
.
devinet_dev
=
{
...
...
net/ipv4/sysctl_net_ipv4.c
View file @
0499eb10
...
...
@@ -77,14 +77,39 @@ static int ipv4_sysctl_forward_strategy(ctl_table *table, int *name, int nlen,
void
*
newval
,
size_t
newlen
,
void
**
context
)
{
int
*
valp
=
table
->
data
;
int
new
;
if
(
!
newval
||
!
newlen
)
return
0
;
if
(
newlen
!=
sizeof
(
int
))
return
-
EINVAL
;
if
(
get_user
(
new
,(
int
*
)
newval
))
if
(
get_user
(
new
,
(
int
*
)
newval
))
return
-
EFAULT
;
if
(
new
!=
ipv4_devconf
.
forwarding
)
if
(
new
==
*
valp
)
return
0
;
if
(
oldval
&&
oldlenp
)
{
size_t
len
;
if
(
get_user
(
len
,
oldlenp
))
return
-
EFAULT
;
if
(
len
)
{
if
(
len
>
table
->
maxlen
)
len
=
table
->
maxlen
;
if
(
copy_to_user
(
oldval
,
valp
,
len
))
return
-
EFAULT
;
if
(
put_user
(
len
,
oldlenp
))
return
-
EFAULT
;
}
}
inet_forward_change
();
return
0
;
/* caller does change again and handles handles oldval */
return
1
;
}
ctl_table
ipv4_table
[]
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment