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
c21c7b41
Commit
c21c7b41
authored
Jan 14, 2004
by
Hideaki Yoshifuji
Committed by
David S. Miller
Jan 14, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV6]: Allow per-device max addresses configurable via sysctl.
parent
c2e514bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
5 deletions
+32
-5
Documentation/networking/ip-sysctl.txt
Documentation/networking/ip-sysctl.txt
+7
-0
include/linux/ipv6.h
include/linux/ipv6.h
+2
-0
include/linux/sysctl.h
include/linux/sysctl.h
+2
-1
include/net/addrconf.h
include/net/addrconf.h
+2
-0
net/ipv6/addrconf.c
net/ipv6/addrconf.c
+19
-4
No files found.
Documentation/networking/ip-sysctl.txt
View file @
c21c7b41
...
...
@@ -667,6 +667,13 @@ regen_max_retry - INTEGER
valid temporary addresses.
Default: 5
max_addresses - INTEGER
Number of maximum addresses per interface. 0 disables limitation.
It is recommended not set too large value (or 0) because it would
be too easy way to crash kernel to allow to create too much of
autoconfigured addresses.
Default: 16
icmp/*:
ratelimit - INTEGER
Limit the maximal rates for sending ICMPv6 packets.
...
...
include/linux/ipv6.h
View file @
c21c7b41
...
...
@@ -143,6 +143,7 @@ struct ipv6_devconf {
__s32
regen_max_retry
;
__s32
max_desync_factor
;
#endif
__s32
max_addresses
;
void
*
sysctl
;
};
...
...
@@ -165,6 +166,7 @@ enum {
DEVCONF_REGEN_MAX_RETRY
,
DEVCONF_MAX_DESYNC_FACTOR
,
#endif
DEVCONF_MAX_ADDRESSES
,
DEVCONF_MAX
};
...
...
include/linux/sysctl.h
View file @
c21c7b41
...
...
@@ -418,7 +418,8 @@ enum {
NET_IPV6_TEMP_VALID_LFT
=
12
,
NET_IPV6_TEMP_PREFERED_LFT
=
13
,
NET_IPV6_REGEN_MAX_RETRY
=
14
,
NET_IPV6_MAX_DESYNC_FACTOR
=
15
NET_IPV6_MAX_DESYNC_FACTOR
=
15
,
NET_IPV6_MAX_ADDRESSES
=
16
};
/* /proc/sys/net/ipv6/icmp */
...
...
include/net/addrconf.h
View file @
c21c7b41
...
...
@@ -15,6 +15,8 @@
#define ADDR_CHECK_FREQUENCY (120*HZ)
#define IPV6_MAX_ADDRESSES 16
struct
prefix_info
{
__u8
type
;
__u8
length
;
...
...
net/ipv6/addrconf.c
View file @
c21c7b41
...
...
@@ -81,8 +81,6 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#define IPV6_MAX_ADDRESSES 16
/* Set to 3 to get tracing... */
#define ACONF_DEBUG 2
...
...
@@ -162,6 +160,7 @@ struct ipv6_devconf ipv6_devconf = {
.
regen_max_retry
=
REGEN_MAX_RETRY
,
.
max_desync_factor
=
MAX_DESYNC_FACTOR
,
#endif
.
max_addresses
=
IPV6_MAX_ADDRESSES
,
};
static
struct
ipv6_devconf
ipv6_devconf_dflt
=
{
...
...
@@ -182,6 +181,7 @@ static struct ipv6_devconf ipv6_devconf_dflt = {
.
regen_max_retry
=
REGEN_MAX_RETRY
,
.
max_desync_factor
=
MAX_DESYNC_FACTOR
,
#endif
.
max_addresses
=
IPV6_MAX_ADDRESSES
,
};
/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
...
...
@@ -633,6 +633,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
unsigned
long
tmp_prefered_lft
,
tmp_valid_lft
;
int
tmp_plen
;
int
ret
=
0
;
int
max_addresses
;
if
(
ift
)
{
spin_lock_bh
(
&
ift
->
lock
);
...
...
@@ -688,9 +689,11 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
ifp
->
prefered_lft
,
idev
->
cnf
.
temp_prefered_lft
-
desync_factor
/
HZ
);
tmp_plen
=
ifp
->
prefix_len
;
max_addresses
=
idev
->
cnf
.
max_addresses
;
write_unlock
(
&
idev
->
lock
);
spin_unlock_bh
(
&
ifp
->
lock
);
ift
=
ipv6_count_addresses
(
idev
)
<
IPV6_MAX_ADDRESSES
?
ift
=
!
max_addresses
||
ipv6_count_addresses
(
idev
)
<
max_addresses
?
ipv6_add_addr
(
idev
,
&
addr
,
tmp_plen
,
ipv6_addr_type
(
&
addr
)
&
IPV6_ADDR_SCOPE_MASK
,
IFA_F_TEMPORARY
)
:
0
;
if
(
!
ift
||
IS_ERR
(
ift
))
{
...
...
@@ -1393,10 +1396,13 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
ifp
=
ipv6_get_ifaddr
(
&
addr
,
dev
);
if
(
ifp
==
NULL
&&
valid_lft
)
{
int
max_addresses
=
in6_dev
->
cnf
.
max_addresses
;
/* Do not allow to create too much of autoconfigured
* addresses; this would be too easy way to crash kernel.
*/
if
(
ipv6_count_addresses
(
in6_dev
)
<
IPV6_MAX_ADDRESSES
)
if
(
!
max_addresses
||
ipv6_count_addresses
(
in6_dev
)
<
max_addresses
)
ifp
=
ipv6_add_addr
(
in6_dev
,
&
addr
,
pinfo
->
prefix_len
,
addr_type
&
IPV6_ADDR_SCOPE_MASK
,
0
);
...
...
@@ -2740,6 +2746,7 @@ static void inline ipv6_store_devconf(struct ipv6_devconf *cnf,
array
[
DEVCONF_REGEN_MAX_RETRY
]
=
cnf
->
regen_max_retry
;
array
[
DEVCONF_MAX_DESYNC_FACTOR
]
=
cnf
->
max_desync_factor
;
#endif
array
[
DEVCONF_MAX_ADDRESSES
]
=
cnf
->
max_addresses
;
}
static
int
inet6_fill_ifinfo
(
struct
sk_buff
*
skb
,
struct
inet6_dev
*
idev
,
...
...
@@ -3165,6 +3172,14 @@ static struct addrconf_sysctl_table
.
proc_handler
=
&
proc_dointvec
,
},
#endif
{
.
ctl_name
=
NET_IPV6_MAX_ADDRESSES
,
.
procname
=
"max_addresses"
,
.
data
=
&
ipv6_devconf
.
max_addresses
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec
,
},
},
.
addrconf_dev
=
{
{
...
...
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