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
nexedi
linux
Commits
d5991ced
Commit
d5991ced
authored
Jan 06, 2004
by
Ville Nuorvala
Committed by
David S. Miller
Jan 06, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV6]: Autoconfig link-local address on ip6-ip6 tunnel device.
parent
9e91e1c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
4 deletions
+54
-4
net/ipv6/addrconf.c
net/ipv6/addrconf.c
+52
-1
net/ipv6/ip6_tunnel.c
net/ipv6/ip6_tunnel.c
+2
-3
No files found.
net/ipv6/addrconf.c
View file @
d5991ced
...
@@ -1809,6 +1809,54 @@ static void addrconf_sit_config(struct net_device *dev)
...
@@ -1809,6 +1809,54 @@ static void addrconf_sit_config(struct net_device *dev)
sit_route_add
(
dev
);
sit_route_add
(
dev
);
}
}
static
inline
int
ipv6_inherit_linklocal
(
struct
inet6_dev
*
idev
,
struct
net_device
*
link_dev
)
{
struct
in6_addr
lladdr
;
if
(
!
ipv6_get_lladdr
(
link_dev
,
&
lladdr
))
{
addrconf_add_linklocal
(
idev
,
&
lladdr
);
return
0
;
}
return
-
1
;
}
static
void
ip6_tnl_add_linklocal
(
struct
inet6_dev
*
idev
)
{
struct
net_device
*
link_dev
;
/* first try to inherit the link-local address from the link device */
if
(
idev
->
dev
->
iflink
&&
(
link_dev
=
__dev_get_by_index
(
idev
->
dev
->
iflink
)))
{
if
(
!
ipv6_inherit_linklocal
(
idev
,
link_dev
))
return
;
}
/* then try to inherit it from any device */
for
(
link_dev
=
dev_base
;
link_dev
;
link_dev
=
link_dev
->
next
)
{
if
(
!
ipv6_inherit_linklocal
(
idev
,
link_dev
))
return
;
}
printk
(
KERN_DEBUG
"init ip6-ip6: add_linklocal failed
\n
"
);
}
/*
* Autoconfigure tunnel with a link-local address so routing protocols,
* DHCPv6, MLD etc. can be run over the virtual link
*/
static
void
addrconf_ip6_tnl_config
(
struct
net_device
*
dev
)
{
struct
inet6_dev
*
idev
;
ASSERT_RTNL
();
if
((
idev
=
addrconf_add_dev
(
dev
))
==
NULL
)
{
printk
(
KERN_DEBUG
"init ip6-ip6: add_dev failed
\n
"
);
return
;
}
ip6_tnl_add_linklocal
(
idev
);
addrconf_add_mroute
(
dev
);
}
int
addrconf_notify
(
struct
notifier_block
*
this
,
unsigned
long
event
,
int
addrconf_notify
(
struct
notifier_block
*
this
,
unsigned
long
event
,
void
*
data
)
void
*
data
)
...
@@ -1822,7 +1870,9 @@ int addrconf_notify(struct notifier_block *this, unsigned long event,
...
@@ -1822,7 +1870,9 @@ int addrconf_notify(struct notifier_block *this, unsigned long event,
case
ARPHRD_SIT
:
case
ARPHRD_SIT
:
addrconf_sit_config
(
dev
);
addrconf_sit_config
(
dev
);
break
;
break
;
case
ARPHRD_TUNNEL6
:
addrconf_ip6_tnl_config
(
dev
);
break
;
case
ARPHRD_LOOPBACK
:
case
ARPHRD_LOOPBACK
:
init_loopback
(
dev
);
init_loopback
(
dev
);
break
;
break
;
...
@@ -2121,6 +2171,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
...
@@ -2121,6 +2171,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
*/
*/
if
(
ifp
->
idev
->
cnf
.
forwarding
==
0
&&
if
(
ifp
->
idev
->
cnf
.
forwarding
==
0
&&
ifp
->
idev
->
cnf
.
rtr_solicits
>
0
&&
(
dev
->
flags
&
IFF_LOOPBACK
)
==
0
&&
(
dev
->
flags
&
IFF_LOOPBACK
)
==
0
&&
(
ipv6_addr_type
(
&
ifp
->
addr
)
&
IPV6_ADDR_LINKLOCAL
))
{
(
ipv6_addr_type
(
&
ifp
->
addr
)
&
IPV6_ADDR_LINKLOCAL
))
{
struct
in6_addr
all_routers
;
struct
in6_addr
all_routers
;
...
...
net/ipv6/ip6_tunnel.c
View file @
d5991ced
...
@@ -821,6 +821,8 @@ static void ip6ip6_tnl_link_config(struct ip6_tnl *t)
...
@@ -821,6 +821,8 @@ static void ip6ip6_tnl_link_config(struct ip6_tnl *t)
else
else
dev
->
flags
&=
~
IFF_POINTOPOINT
;
dev
->
flags
&=
~
IFF_POINTOPOINT
;
dev
->
iflink
=
p
->
link
;
if
(
p
->
flags
&
IP6_TNL_F_CAP_XMIT
)
{
if
(
p
->
flags
&
IP6_TNL_F_CAP_XMIT
)
{
struct
rt6_info
*
rt
=
rt6_lookup
(
&
p
->
raddr
,
&
p
->
laddr
,
struct
rt6_info
*
rt
=
rt6_lookup
(
&
p
->
raddr
,
&
p
->
laddr
,
p
->
link
,
0
);
p
->
link
,
0
);
...
@@ -829,8 +831,6 @@ static void ip6ip6_tnl_link_config(struct ip6_tnl *t)
...
@@ -829,8 +831,6 @@ static void ip6ip6_tnl_link_config(struct ip6_tnl *t)
return
;
return
;
if
(
rt
->
rt6i_dev
)
{
if
(
rt
->
rt6i_dev
)
{
dev
->
iflink
=
rt
->
rt6i_dev
->
ifindex
;
dev
->
hard_header_len
=
rt
->
rt6i_dev
->
hard_header_len
+
dev
->
hard_header_len
=
rt
->
rt6i_dev
->
hard_header_len
+
sizeof
(
struct
ipv6hdr
);
sizeof
(
struct
ipv6hdr
);
...
@@ -1040,7 +1040,6 @@ static void ip6ip6_tnl_dev_setup(struct net_device *dev)
...
@@ -1040,7 +1040,6 @@ static void ip6ip6_tnl_dev_setup(struct net_device *dev)
dev
->
hard_header_len
=
LL_MAX_HEADER
+
sizeof
(
struct
ipv6hdr
);
dev
->
hard_header_len
=
LL_MAX_HEADER
+
sizeof
(
struct
ipv6hdr
);
dev
->
mtu
=
ETH_DATA_LEN
-
sizeof
(
struct
ipv6hdr
);
dev
->
mtu
=
ETH_DATA_LEN
-
sizeof
(
struct
ipv6hdr
);
dev
->
flags
|=
IFF_NOARP
;
dev
->
flags
|=
IFF_NOARP
;
dev
->
iflink
=
0
;
dev
->
addr_len
=
sizeof
(
struct
in6_addr
);
dev
->
addr_len
=
sizeof
(
struct
in6_addr
);
}
}
...
...
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