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
2b25a889
Commit
2b25a889
authored
Nov 10, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge nuts.ninka.net:/home/davem/src/BK/network-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents
5be2bc3c
75cfea47
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
63 deletions
+93
-63
net/ipv4/arp.c
net/ipv4/arp.c
+93
-63
No files found.
net/ipv4/arp.c
View file @
2b25a889
...
...
@@ -1142,65 +1142,115 @@ struct arp_iter_state {
int
is_pneigh
,
bucket
;
};
static
__inline__
struct
neighbour
*
neigh_get_bucket
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
static
struct
neighbour
*
neigh_get_first
(
struct
seq_file
*
seq
)
{
struct
neighbour
*
n
=
NULL
;
struct
arp_iter_state
*
state
=
seq
->
private
;
loff_t
l
=
*
pos
;
int
i
;
for
(;
state
->
bucket
<=
NEIGH_HASHMASK
;
++
state
->
bucket
)
for
(
i
=
0
,
n
=
arp_tbl
.
hash_buckets
[
state
->
bucket
];
n
;
++
i
,
n
=
n
->
next
)
/* Do not confuse users "arp -a" with magic entries */
if
((
n
->
nud_state
&
~
NUD_NOARP
)
&&
!
l
--
)
{
*
pos
=
i
;
goto
out
;
struct
neighbour
*
n
;
state
->
is_pneigh
=
0
;
for
(
state
->
bucket
=
0
;
state
->
bucket
<=
NEIGH_HASHMASK
;
++
state
->
bucket
)
{
n
=
arp_tbl
.
hash_buckets
[
state
->
bucket
];
while
(
n
&&
!
(
n
->
nud_state
&
~
NUD_NOARP
))
n
=
n
->
next
;
if
(
n
)
break
;
}
out:
return
n
;
}
static
__inline__
struct
pneigh_entry
*
pneigh_get_bucke
t
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
static
struct
neighbour
*
neigh_get_nex
t
(
struct
seq_file
*
seq
,
struct
neighbour
*
n
)
{
struct
pneigh_entry
*
n
=
NULL
;
struct
arp_iter_state
*
state
=
seq
->
private
;
loff_t
l
=
*
pos
;
int
i
;
for
(;
state
->
bucket
<=
PNEIGH_HASHMASK
;
++
state
->
bucket
)
for
(
i
=
0
,
n
=
arp_tbl
.
phash_buckets
[
state
->
bucket
];
n
;
++
i
,
n
=
n
->
next
)
if
(
!
l
--
)
{
*
pos
=
i
;
do
{
n
=
n
->
next
;
/* Don't confuse "arp -a" w/ magic entries */
try_again:
}
while
(
n
&&
!
(
n
->
nud_state
&
~
NUD_NOARP
));
if
(
n
)
goto
out
;
}
if
(
++
state
->
bucket
>
NEIGH_HASHMASK
)
goto
out
;
n
=
arp_tbl
.
hash_buckets
[
state
->
bucket
];
goto
try_again
;
out:
return
n
;
}
static
__inline__
void
*
arp_get_bucket
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
static
struct
neighbour
*
neigh_get_idx
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
void
*
rc
=
neigh_get_bucket
(
seq
,
pos
);
struct
neighbour
*
n
=
neigh_get_first
(
seq
);
if
(
!
rc
)
{
if
(
n
)
while
(
*
pos
&&
(
n
=
neigh_get_next
(
seq
,
n
)))
--*
pos
;
return
*
pos
?
NULL
:
n
;
}
static
struct
pneigh_entry
*
pneigh_get_first
(
struct
seq_file
*
seq
)
{
struct
arp_iter_state
*
state
=
seq
->
private
;
struct
pneigh_entry
*
pn
;
read_unlock_bh
(
&
arp_tbl
.
lock
);
state
->
is_pneigh
=
1
;
state
->
bucket
=
0
;
*
pos
=
0
;
rc
=
pneigh_get_bucket
(
seq
,
pos
);
for
(
state
->
bucket
=
0
;
state
->
bucket
<=
PNEIGH_HASHMASK
;
++
state
->
bucket
)
{
pn
=
arp_tbl
.
phash_buckets
[
state
->
bucket
];
if
(
pn
)
break
;
}
return
pn
;
}
static
struct
pneigh_entry
*
pneigh_get_next
(
struct
seq_file
*
seq
,
struct
pneigh_entry
*
pn
)
{
struct
arp_iter_state
*
state
=
seq
->
private
;
pn
=
pn
->
next
;
while
(
!
pn
)
{
if
(
++
state
->
bucket
>
PNEIGH_HASHMASK
)
break
;
pn
=
arp_tbl
.
phash_buckets
[
state
->
bucket
];
}
return
pn
;
}
static
struct
pneigh_entry
*
pneigh_get_idx
(
struct
seq_file
*
seq
,
loff_t
pos
)
{
struct
pneigh_entry
*
pn
=
pneigh_get_first
(
seq
);
if
(
pn
)
while
(
pos
&&
(
pn
=
pneigh_get_next
(
seq
,
pn
)))
--
pos
;
return
pos
?
NULL
:
pn
;
}
static
void
*
arp_get_idx
(
struct
seq_file
*
seq
,
loff_t
pos
)
{
void
*
rc
;
read_lock_bh
(
&
arp_tbl
.
lock
);
rc
=
neigh_get_idx
(
seq
,
&
pos
);
if
(
!
rc
)
{
read_unlock_bh
(
&
arp_tbl
.
lock
);
rc
=
pneigh_get_idx
(
seq
,
pos
);
}
return
rc
;
}
static
void
*
arp_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
read_lock_bh
(
&
arp_tbl
.
lock
);
return
*
pos
?
arp_get_bucket
(
seq
,
pos
)
:
(
void
*
)
1
;
return
*
pos
?
arp_get_idx
(
seq
,
*
pos
-
1
)
:
(
void
*
)
1
;
}
static
void
*
arp_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
...
...
@@ -1209,38 +1259,19 @@ static void *arp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
struct
arp_iter_state
*
state
;
if
(
v
==
(
void
*
)
1
)
{
rc
=
arp_get_
bucket
(
seq
,
pos
);
rc
=
arp_get_
idx
(
seq
,
0
);
goto
out
;
}
state
=
seq
->
private
;
if
(
!
state
->
is_pneigh
)
{
struct
neighbour
*
n
=
v
;
rc
=
n
=
n
->
next
;
if
(
n
)
goto
out
;
*
pos
=
0
;
++
state
->
bucket
;
rc
=
neigh_get_bucket
(
seq
,
pos
);
rc
=
neigh_get_next
(
seq
,
v
);
if
(
rc
)
goto
out
;
read_unlock_bh
(
&
arp_tbl
.
lock
);
state
->
is_pneigh
=
1
;
state
->
bucket
=
0
;
*
pos
=
0
;
rc
=
pneigh_get_bucket
(
seq
,
pos
);
}
else
{
struct
pneigh_entry
*
pn
=
v
;
pn
=
pn
->
next
;
if
(
!
pn
)
{
++
state
->
bucket
;
*
pos
=
0
;
pn
=
pneigh_get_bucket
(
seq
,
pos
);
}
rc
=
pn
;
}
rc
=
pneigh_get_first
(
seq
);
}
else
rc
=
pneigh_get_next
(
seq
,
v
);
out:
++*
pos
;
return
rc
;
...
...
@@ -1291,7 +1322,6 @@ static __inline__ void arp_format_neigh_entry(struct seq_file *seq,
static
__inline__
void
arp_format_pneigh_entry
(
struct
seq_file
*
seq
,
struct
pneigh_entry
*
n
)
{
struct
net_device
*
dev
=
n
->
dev
;
int
hatype
=
dev
?
dev
->
type
:
0
;
char
tbuf
[
16
];
...
...
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