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
cb6b9085
Commit
cb6b9085
authored
Sep 28, 2004
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV4]: Do fib_alias lookup walk directly in fib_semantic_match().
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
c6ccac36
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
61 deletions
+66
-61
net/ipv4/fib_hash.c
net/ipv4/fib_hash.c
+5
-23
net/ipv4/fib_lookup.h
net/ipv4/fib_lookup.h
+3
-2
net/ipv4/fib_semantics.c
net/ipv4/fib_semantics.c
+58
-36
No files found.
net/ipv4/fib_hash.c
View file @
cb6b9085
...
@@ -256,32 +256,14 @@ fn_hash_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
...
@@ -256,32 +256,14 @@ fn_hash_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
head
=
&
fz
->
fz_hash
[
fn_hash
(
k
,
fz
)];
head
=
&
fz
->
fz_hash
[
fn_hash
(
k
,
fz
)];
hlist_for_each_entry
(
f
,
node
,
head
,
fn_hash
)
{
hlist_for_each_entry
(
f
,
node
,
head
,
fn_hash
)
{
struct
fib_alias
*
fa
;
if
(
f
->
fn_key
!=
k
)
if
(
f
->
fn_key
!=
k
)
continue
;
continue
;
list_for_each_entry
(
fa
,
&
f
->
fn_alias
,
fa_list
)
{
err
=
fib_semantic_match
(
&
f
->
fn_alias
,
if
(
fa
->
fa_tos
&&
flp
,
res
,
fa
->
fa_tos
!=
flp
->
fl4_tos
)
fz
->
fz_order
);
continue
;
if
(
err
<=
0
)
if
(
fa
->
fa_scope
<
flp
->
fl4_scope
)
goto
out
;
continue
;
fa
->
fa_state
|=
FA_S_ACCESSED
;
err
=
fib_semantic_match
(
fa
->
fa_type
,
fa
->
fa_info
,
flp
,
res
);
if
(
err
==
0
)
{
res
->
type
=
fa
->
fa_type
;
res
->
scope
=
fa
->
fa_scope
;
res
->
prefixlen
=
fz
->
fz_order
;
goto
out
;
}
if
(
err
<
0
)
goto
out
;
}
}
}
}
}
err
=
1
;
err
=
1
;
...
...
net/ipv4/fib_lookup.h
View file @
cb6b9085
...
@@ -17,8 +17,9 @@ struct fib_alias {
...
@@ -17,8 +17,9 @@ struct fib_alias {
#define FA_S_ACCESSED 0x01
#define FA_S_ACCESSED 0x01
/* Exported by fib_semantics.c */
/* Exported by fib_semantics.c */
extern
int
fib_semantic_match
(
int
type
,
struct
fib_info
*
,
extern
int
fib_semantic_match
(
struct
list_head
*
head
,
const
struct
flowi
*
,
struct
fib_result
*
);
const
struct
flowi
*
flp
,
struct
fib_result
*
res
,
int
prefixlen
);
extern
void
fib_release_info
(
struct
fib_info
*
);
extern
void
fib_release_info
(
struct
fib_info
*
);
extern
struct
fib_info
*
fib_create_info
(
const
struct
rtmsg
*
r
,
extern
struct
fib_info
*
fib_create_info
(
const
struct
rtmsg
*
r
,
struct
kern_rta
*
rta
,
struct
kern_rta
*
rta
,
...
...
net/ipv4/fib_semantics.c
View file @
cb6b9085
...
@@ -760,51 +760,73 @@ fib_create_info(const struct rtmsg *r, struct kern_rta *rta,
...
@@ -760,51 +760,73 @@ fib_create_info(const struct rtmsg *r, struct kern_rta *rta,
return
NULL
;
return
NULL
;
}
}
int
int
fib_semantic_match
(
struct
list_head
*
head
,
const
struct
flowi
*
flp
,
fib_semantic_match
(
int
type
,
struct
fib_info
*
fi
,
const
struct
flowi
*
flp
,
struct
fib_result
*
res
)
struct
fib_result
*
res
,
int
prefixlen
)
{
{
int
err
=
fib_props
[
type
].
error
;
struct
fib_alias
*
fa
;
int
nh_sel
=
0
;
if
(
err
==
0
)
{
list_for_each_entry
(
fa
,
head
,
fa_list
)
{
if
(
fi
->
fib_flags
&
RTNH_F_DEAD
)
int
err
;
return
1
;
res
->
fi
=
fi
;
if
(
fa
->
fa_tos
&&
fa
->
fa_tos
!=
flp
->
fl4_tos
)
continue
;
switch
(
type
)
{
if
(
fa
->
fa_scope
<
flp
->
fl4_scope
)
case
RTN_UNICAST
:
continue
;
case
RTN_LOCAL
:
case
RTN_BROADCAST
:
fa
->
fa_state
|=
FA_S_ACCESSED
;
case
RTN_ANYCAST
:
case
RTN_MULTICAST
:
err
=
fib_props
[
fa
->
fa_type
].
error
;
for_nexthops
(
fi
)
{
if
(
err
==
0
)
{
if
(
nh
->
nh_flags
&
RTNH_F_DEAD
)
struct
fib_info
*
fi
=
fa
->
fa_info
;
continue
;
if
(
!
flp
->
oif
||
flp
->
oif
==
nh
->
nh_oif
)
if
(
fi
->
fib_flags
&
RTNH_F_DEAD
)
break
;
continue
;
}
switch
(
fa
->
fa_type
)
{
case
RTN_UNICAST
:
case
RTN_LOCAL
:
case
RTN_BROADCAST
:
case
RTN_ANYCAST
:
case
RTN_MULTICAST
:
for_nexthops
(
fi
)
{
if
(
nh
->
nh_flags
&
RTNH_F_DEAD
)
continue
;
if
(
!
flp
->
oif
||
flp
->
oif
==
nh
->
nh_oif
)
break
;
}
#ifdef CONFIG_IP_ROUTE_MULTIPATH
#ifdef CONFIG_IP_ROUTE_MULTIPATH
if
(
nhsel
<
fi
->
fib_nhs
)
{
if
(
nhsel
<
fi
->
fib_nhs
)
{
res
->
nh_sel
=
nhsel
;
nh_sel
=
nhsel
;
atomic_inc
(
&
fi
->
fib_clntref
);
goto
out_fill_res
;
return
0
;
}
}
#else
#else
if
(
nhsel
<
1
)
{
if
(
nhsel
<
1
)
{
atomic_inc
(
&
fi
->
fib_clntref
);
goto
out_fill_res
;
return
0
;
}
}
#endif
#endif
endfor_nexthops
(
fi
);
endfor_nexthops
(
fi
);
res
->
fi
=
NULL
;
continue
;
return
1
;
default:
default:
res
->
fi
=
NULL
;
printk
(
KERN_DEBUG
"impossible 102
\n
"
)
;
printk
(
KERN_DEBUG
"impossible 102
\n
"
)
;
return
-
EINVAL
;
return
-
EINVAL
;
}
;
}
}
return
err
;
}
}
return
err
;
return
1
;
out_fill_res:
res
->
prefixlen
=
prefixlen
;
res
->
nh_sel
=
nh_sel
;
res
->
type
=
fa
->
fa_type
;
res
->
scope
=
fa
->
fa_scope
;
res
->
fi
=
fa
->
fa_info
;
atomic_inc
(
&
res
->
fi
->
fib_clntref
);
return
0
;
}
}
/* Find appropriate source address to this destination */
/* Find appropriate source address to this destination */
...
...
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