Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
8138dfc2
Commit
8138dfc2
authored
Aug 16, 2007
by
Grégoire Henry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changement de signature pour kernel_route.
Ajout des parametres newgate et newifindex.
parent
54347c5d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
9 deletions
+16
-9
kernel.c
kernel.c
+9
-5
kernel.h
kernel.h
+3
-2
route.c
route.c
+4
-2
No files found.
kernel.c
View file @
8138dfc2
...
...
@@ -580,8 +580,9 @@ kernel_interface_wireless(const char *ifname, int ifindex)
int
kernel_route
(
int
operation
,
const
unsigned
char
*
dest
,
unsigned
short
plen
,
const
unsigned
char
*
gate
,
int
ifindex
,
unsigned
int
metric
,
unsigned
int
newmetric
)
const
unsigned
char
*
gate
,
int
ifindex
,
unsigned
int
metric
,
const
unsigned
char
*
newgate
,
int
newifindex
,
unsigned
int
newmetric
)
{
union
{
char
raw
[
1024
];
struct
nlmsghdr
nh
;
}
buf
;
...
...
@@ -591,12 +592,15 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
int
rc
;
if
(
operation
==
ROUTE_MODIFY
)
{
if
(
newmetric
==
metric
)
if
(
newmetric
==
metric
&&
memcmp
(
newgate
,
gate
,
16
)
==
0
&&
newifindex
==
ifindex
)
return
0
;
rc
=
kernel_route
(
ROUTE_ADD
,
dest
,
plen
,
gate
,
ifindex
,
newmetric
,
0
);
rc
=
kernel_route
(
ROUTE_ADD
,
dest
,
plen
,
newgate
,
newifindex
,
newmetric
,
NULL
,
0
,
0
);
if
(
rc
<
0
&&
errno
!=
EEXIST
)
return
rc
;
rc
=
kernel_route
(
ROUTE_FLUSH
,
dest
,
plen
,
gate
,
ifindex
,
metric
,
0
);
rc
=
kernel_route
(
ROUTE_FLUSH
,
dest
,
plen
,
gate
,
ifindex
,
metric
,
NULL
,
0
,
0
);
if
(
rc
<
0
&&
(
errno
==
ENOENT
||
errno
==
ESRCH
))
rc
=
1
;
return
rc
;
...
...
kernel.h
View file @
8138dfc2
...
...
@@ -39,7 +39,8 @@ int kernel_setup_interface(int setup, const char *ifname, int ifindex);
int
kernel_interface_mtu
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_interface_wireless
(
const
char
*
ifname
,
int
ifindex
);
int
kernel_route
(
int
operation
,
const
unsigned
char
*
dest
,
unsigned
short
plen
,
const
unsigned
char
*
gate
,
int
ifindex
,
unsigned
int
metric
,
unsigned
int
newmetric
);
const
unsigned
char
*
gate
,
int
ifindex
,
unsigned
int
metric
,
const
unsigned
char
*
newgate
,
int
newifindex
,
unsigned
int
newmetric
);
int
kernel_routes
(
int
maxplen
,
struct
kernel_route
*
routes
,
int
maxroutes
);
int
kernel_callback
(
int
(
*
fn
)(
void
*
),
void
*
closure
);
route.c
View file @
8138dfc2
...
...
@@ -130,7 +130,7 @@ install_route(struct route *route)
rc
=
kernel_route
(
ROUTE_ADD
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
nexthop
->
address
,
route
->
nexthop
->
network
->
ifindex
,
metric_to_kernel
(
route
->
metric
),
0
);
metric_to_kernel
(
route
->
metric
),
NULL
,
0
,
0
);
if
(
rc
<
0
)
{
perror
(
"kernel_route(ADD)"
);
if
(
errno
!=
EEXIST
)
...
...
@@ -150,7 +150,7 @@ uninstall_route(struct route *route)
rc
=
kernel_route
(
ROUTE_FLUSH
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
nexthop
->
address
,
route
->
nexthop
->
network
->
ifindex
,
metric_to_kernel
(
route
->
metric
),
0
);
metric_to_kernel
(
route
->
metric
),
NULL
,
0
,
0
);
if
(
rc
<
0
)
perror
(
"kernel_route(FLUSH)"
);
...
...
@@ -168,6 +168,8 @@ change_route_metric(struct route *route, int newmetric)
route
->
nexthop
->
address
,
route
->
nexthop
->
network
->
ifindex
,
metric_to_kernel
(
route
->
metric
),
route
->
nexthop
->
address
,
route
->
nexthop
->
network
->
ifindex
,
metric_to_kernel
(
newmetric
));
if
(
rc
<
0
)
{
perror
(
"kernel_route(MODIFY)"
);
...
...
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