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
d01ee8ec
Commit
d01ee8ec
authored
Jun 08, 2003
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV6]: ipv6_addr_prefix() cleanup, eliminate duplication.
parent
de4aca03
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
45 deletions
+15
-45
include/net/ipv6.h
include/net/ipv6.h
+15
-0
net/ipv6/addrconf.c
net/ipv6/addrconf.c
+0
-32
net/ipv6/route.c
net/ipv6/route.c
+0
-13
No files found.
include/net/ipv6.h
View file @
d01ee8ec
...
@@ -263,6 +263,21 @@ static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2
...
@@ -263,6 +263,21 @@ static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2
memcpy
((
void
*
)
a1
,
(
const
void
*
)
a2
,
sizeof
(
struct
in6_addr
));
memcpy
((
void
*
)
a1
,
(
const
void
*
)
a2
,
sizeof
(
struct
in6_addr
));
}
}
static
inline
void
ipv6_addr_prefix
(
struct
in6_addr
*
pfx
,
const
struct
in6_addr
*
addr
,
int
plen
)
{
/* caller must guarantee 0 <= plen <= 128 */
int
o
=
plen
>>
3
,
b
=
plen
&
0x7
;
memcpy
(
pfx
->
s6_addr
,
addr
,
o
);
if
(
b
!=
0
)
pfx
->
s6_addr
[
o
]
=
addr
->
s6_addr
[
o
]
&
(
0xff00
>>
b
);
if
(
o
<
16
)
memset
(
pfx
->
s6_addr
+
o
,
0
,
16
-
o
);
}
#ifndef __HAVE_ARCH_ADDR_SET
#ifndef __HAVE_ARCH_ADDR_SET
static
inline
void
ipv6_addr_set
(
struct
in6_addr
*
addr
,
static
inline
void
ipv6_addr_set
(
struct
in6_addr
*
addr
,
__u32
w1
,
__u32
w2
,
__u32
w1
,
__u32
w2
,
...
...
net/ipv6/addrconf.c
View file @
d01ee8ec
...
@@ -400,38 +400,6 @@ static struct inet6_dev * ipv6_find_idev(struct net_device *dev)
...
@@ -400,38 +400,6 @@ static struct inet6_dev * ipv6_find_idev(struct net_device *dev)
return
idev
;
return
idev
;
}
}
void
ipv6_addr_prefix
(
struct
in6_addr
*
prefix
,
struct
in6_addr
*
addr
,
int
prefix_len
)
{
unsigned
long
mask
;
int
ncopy
,
nbits
;
memset
(
prefix
,
0
,
sizeof
(
*
prefix
));
if
(
prefix_len
<=
0
)
return
;
if
(
prefix_len
>
128
)
prefix_len
=
128
;
ncopy
=
prefix_len
/
32
;
switch
(
ncopy
)
{
case
4
:
prefix
->
s6_addr32
[
3
]
=
addr
->
s6_addr32
[
3
];
case
3
:
prefix
->
s6_addr32
[
2
]
=
addr
->
s6_addr32
[
2
];
case
2
:
prefix
->
s6_addr32
[
1
]
=
addr
->
s6_addr32
[
1
];
case
1
:
prefix
->
s6_addr32
[
0
]
=
addr
->
s6_addr32
[
0
];
case
0
:
break
;
}
nbits
=
prefix_len
%
32
;
if
(
nbits
==
0
)
return
;
mask
=
~
((
1
<<
(
32
-
nbits
))
-
1
);
mask
=
htonl
(
mask
);
prefix
->
s6_addr32
[
ncopy
]
=
addr
->
s6_addr32
[
ncopy
]
&
mask
;
}
static
void
dev_forward_change
(
struct
inet6_dev
*
idev
)
static
void
dev_forward_change
(
struct
inet6_dev
*
idev
)
{
{
struct
net_device
*
dev
;
struct
net_device
*
dev
;
...
...
net/ipv6/route.c
View file @
d01ee8ec
...
@@ -587,19 +587,6 @@ static int ip6_dst_gc(void)
...
@@ -587,19 +587,6 @@ static int ip6_dst_gc(void)
Remove it only when all the things will work!
Remove it only when all the things will work!
*/
*/
static
void
ipv6_addr_prefix
(
struct
in6_addr
*
pfx
,
const
struct
in6_addr
*
addr
,
int
plen
)
{
int
b
=
plen
&
0x7
;
int
o
=
plen
>>
3
;
memcpy
(
pfx
->
s6_addr
,
addr
,
o
);
if
(
o
<
16
)
memset
(
pfx
->
s6_addr
+
o
,
0
,
16
-
o
);
if
(
b
!=
0
)
pfx
->
s6_addr
[
o
]
=
addr
->
s6_addr
[
o
]
&
(
0xff00
>>
b
);
}
static
int
ipv6_get_mtu
(
struct
net_device
*
dev
)
static
int
ipv6_get_mtu
(
struct
net_device
*
dev
)
{
{
int
mtu
=
IPV6_MIN_MTU
;
int
mtu
=
IPV6_MIN_MTU
;
...
...
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