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
1e57b71b
Commit
1e57b71b
authored
Dec 28, 2019
by
Antonin Décimo
Committed by
Juliusz Chroboczek
Sep 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reformat kernel_netlink.c.
parent
a1043879
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
kernel_netlink.c
kernel_netlink.c
+27
-27
No files found.
kernel_netlink.c
View file @
1e57b71b
...
@@ -651,13 +651,13 @@ get_old_if(const char *ifname)
...
@@ -651,13 +651,13 @@ get_old_if(const char *ifname)
if
(
num_old_if
>=
MAX_INTERFACES
)
if
(
num_old_if
>=
MAX_INTERFACES
)
return
-
1
;
return
-
1
;
if
(
num_old_if
>=
max_old_if
)
{
if
(
num_old_if
>=
max_old_if
)
{
int
n
=
max_old_if
==
0
?
4
:
2
*
max_old_if
;
int
n
=
max_old_if
==
0
?
4
:
2
*
max_old_if
;
struct
old_if
*
new
=
struct
old_if
*
new
=
realloc
(
old_if
,
n
*
sizeof
(
struct
old_if
));
realloc
(
old_if
,
n
*
sizeof
(
struct
old_if
));
if
(
new
!=
NULL
)
{
if
(
new
!=
NULL
)
{
old_if
=
new
;
old_if
=
new
;
max_old_if
=
n
;
max_old_if
=
n
;
}
}
}
}
if
(
num_old_if
>=
max_old_if
)
if
(
num_old_if
>=
max_old_if
)
return
-
1
;
return
-
1
;
...
@@ -690,11 +690,11 @@ kernel_setup_interface(int setup, const char *ifname, int ifindex)
...
@@ -690,11 +690,11 @@ kernel_setup_interface(int setup, const char *ifname, int ifindex)
fprintf
(
stderr
,
fprintf
(
stderr
,
"Warning: cannot save old configuration for %s.
\n
"
,
"Warning: cannot save old configuration for %s.
\n
"
,
ifname
);
ifname
);
if
(
old_if
[
i
].
rp_filter
)
{
if
(
old_if
[
i
].
rp_filter
)
{
rc
=
write_proc
(
buf
,
0
);
rc
=
write_proc
(
buf
,
0
);
if
(
rc
<
0
)
if
(
rc
<
0
)
return
-
1
;
return
-
1
;
}
}
}
else
{
}
else
{
if
(
i
>=
0
&&
old_if
[
i
].
rp_filter
>
0
)
if
(
i
>=
0
&&
old_if
[
i
].
rp_filter
>
0
)
rc
=
write_proc
(
buf
,
old_if
[
i
].
rp_filter
);
rc
=
write_proc
(
buf
,
old_if
[
i
].
rp_filter
);
...
@@ -1085,17 +1085,17 @@ kernel_route(int operation, int table,
...
@@ -1085,17 +1085,17 @@ kernel_route(int operation, int table,
rta
->
rta_type
=
RTA_OIF
;
rta
->
rta_type
=
RTA_OIF
;
*
(
int
*
)
RTA_DATA
(
rta
)
=
ifindex
;
*
(
int
*
)
RTA_DATA
(
rta
)
=
ifindex
;
#define ADD_IPARG(type, addr) \
#define ADD_IPARG(type, addr)
\
do if(ipv4) { \
do if(ipv4) {
\
rta = RTA_NEXT(rta, len); \
rta = RTA_NEXT(rta, len);
\
rta->rta_len = RTA_LENGTH(sizeof(struct in_addr)); \
rta->rta_len = RTA_LENGTH(sizeof(struct in_addr));
\
rta->rta_type = type; \
rta->rta_type = type;
\
memcpy(RTA_DATA(rta), addr + 12, sizeof(struct in_addr)); \
memcpy(RTA_DATA(rta), addr + 12, sizeof(struct in_addr));
\
} else { \
} else {
\
rta = RTA_NEXT(rta, len); \
rta = RTA_NEXT(rta, len);
\
rta->rta_len = RTA_LENGTH(sizeof(struct in6_addr)); \
rta->rta_len = RTA_LENGTH(sizeof(struct in6_addr));
\
rta->rta_type = type; \
rta->rta_type = type;
\
memcpy(RTA_DATA(rta), addr, sizeof(struct in6_addr)); \
memcpy(RTA_DATA(rta), addr, sizeof(struct in6_addr));
\
} while (0)
} while (0)
ADD_IPARG
(
RTA_GATEWAY
,
gate
);
ADD_IPARG
(
RTA_GATEWAY
,
gate
);
...
@@ -1203,10 +1203,10 @@ print_kernel_route(int add, int protocol, int type,
...
@@ -1203,10 +1203,10 @@ print_kernel_route(int add, int protocol, int type,
}
}
kdebugf
(
"%s kernel route: dest: %s/%d gw: %s metric: %d if: %s "
kdebugf
(
"%s kernel route: dest: %s/%d gw: %s metric: %d if: %s "
"(proto: %d, type: %d)"
,
"(proto: %d, type: %d)"
,
add
==
RTM_NEWROUTE
?
"Add"
:
"Delete"
,
add
==
RTM_NEWROUTE
?
"Add"
:
"Delete"
,
addr_prefix
,
route
->
plen
,
addr_gw
,
route
->
metric
,
ifname
,
addr_prefix
,
route
->
plen
,
addr_gw
,
route
->
metric
,
ifname
,
protocol
,
type
);
protocol
,
type
);
}
}
static
int
static
int
...
...
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