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
f4ad1c46
Commit
f4ad1c46
authored
Aug 30, 2007
by
Grégoire Henry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel.c : Fix kernel_route(MODIFY) on OSX.
parent
6972e002
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
kernel_socket.c
kernel_socket.c
+22
-9
No files found.
kernel_socket.c
View file @
f4ad1c46
...
...
@@ -265,9 +265,17 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
memcmp
(
newgate
,
gate
,
16
)
==
0
&&
newifindex
==
ifindex
)
return
0
;
metric
=
newmetric
;
gate
=
newgate
;
ifindex
=
newifindex
;
if
(
operation
==
ROUTE_MODIFY
)
{
metric
=
newmetric
;
gate
=
newgate
;
ifindex
=
newifindex
;
}
debugf
(
"kernel_route: %s %s/%d metric %d dev %d nexthop %s
\n
"
,
operation
==
ROUTE_ADD
?
"add"
:
operation
==
ROUTE_FLUSH
?
"flush"
:
"change"
,
format_address
(
dest
),
plen
,
metric
,
ifindex
,
format_address
(
gate
));
if
(
kernel_socket
<
0
)
kernel_setup_socket
(
1
);
...
...
@@ -280,7 +288,7 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
case
ROUTE_ADD
:
rtm
->
rtm_type
=
RTM_ADD
;
break
;
case
ROUTE_MODIFY
:
rtm
->
rtm_type
=
RTM_
DELET
E
;
break
;
rtm
->
rtm_type
=
RTM_
CHANG
E
;
break
;
default:
return
-
1
;
};
...
...
@@ -303,7 +311,10 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
rtm
->
rtm_index
=
ifindex_lo
;
}
rtm
->
rtm_seq
=
++
seq
;
rtm
->
rtm_addrs
=
RTA_DST
|
RTA_GATEWAY
|
RTA_NETMASK
;
rtm
->
rtm_addrs
=
RTA_DST
|
RTA_GATEWAY
;
if
(
!
(
operation
==
ROUTE_MODIFY
&&
plen
==
128
))
{
rtm
->
rtm_addrs
|=
RTA_NETMASK
;
}
rtm
->
rtm_rmx
.
rmx_hopcount
=
metric
;
rtm
->
rtm_inits
=
RTV_HOPCOUNT
;
...
...
@@ -324,10 +335,12 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
SET_IN6_LINKLOCAL_IFINDEX
(
sin6
->
sin6_addr
,
ifindex
);
sin6
=
(
struct
sockaddr_in6
*
)((
char
*
)
sin6
+
ROUNDUP
(
sin6
->
sin6_len
));
/* Netmask */
sin6
->
sin6_len
=
sizeof
(
struct
sockaddr_in6
);
sin6
->
sin6_family
=
AF_INET6
;
plen2mask
(
plen
,
&
sin6
->
sin6_addr
);
sin6
=
(
struct
sockaddr_in6
*
)((
char
*
)
sin6
+
ROUNDUP
(
sin6
->
sin6_len
));
if
((
rtm
->
rtm_addrs
|
RTA_NETMASK
)
!=
0
)
{
sin6
->
sin6_len
=
sizeof
(
struct
sockaddr_in6
);
sin6
->
sin6_family
=
AF_INET6
;
plen2mask
(
plen
,
&
sin6
->
sin6_addr
);
sin6
=
(
struct
sockaddr_in6
*
)((
char
*
)
sin6
+
ROUNDUP
(
sin6
->
sin6_len
));
}
len
=
(
char
*
)
sin6
-
(
char
*
)
msg
;
rtm
->
rtm_msglen
=
len
;
...
...
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