Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
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
iproute2
Commits
6cf8398f
Commit
6cf8398f
authored
Dec 23, 2011
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libnetlink: change rtnl_send() to take void *
Avoid having to cast buffer being sent.
parent
3c7950af
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
11 deletions
+8
-11
genl/ctrl.c
genl/ctrl.c
+1
-1
include/libnetlink.h
include/libnetlink.h
+2
-2
ip/iplink.c
ip/iplink.c
+1
-1
lib/libnetlink.c
lib/libnetlink.c
+3
-6
misc/arpd.c
misc/arpd.c
+1
-1
No files found.
genl/ctrl.c
View file @
6cf8398f
...
@@ -350,7 +350,7 @@ static int ctrl_list(int cmd, int argc, char **argv)
...
@@ -350,7 +350,7 @@ static int ctrl_list(int cmd, int argc, char **argv)
nlh
->
nlmsg_flags
=
NLM_F_ROOT
|
NLM_F_MATCH
|
NLM_F_REQUEST
;
nlh
->
nlmsg_flags
=
NLM_F_ROOT
|
NLM_F_MATCH
|
NLM_F_REQUEST
;
nlh
->
nlmsg_seq
=
rth
.
dump
=
++
rth
.
seq
;
nlh
->
nlmsg_seq
=
rth
.
dump
=
++
rth
.
seq
;
if
(
rtnl_send
(
&
rth
,
(
const
char
*
)
nlh
,
nlh
->
nlmsg_len
)
<
0
)
{
if
(
rtnl_send
(
&
rth
,
nlh
,
nlh
->
nlmsg_len
)
<
0
)
{
perror
(
"Failed to send dump request
\n
"
);
perror
(
"Failed to send dump request
\n
"
);
goto
ctrl_done
;
goto
ctrl_done
;
}
}
...
...
include/libnetlink.h
View file @
6cf8398f
...
@@ -47,8 +47,8 @@ extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
...
@@ -47,8 +47,8 @@ extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
unsigned
groups
,
struct
nlmsghdr
*
answer
,
unsigned
groups
,
struct
nlmsghdr
*
answer
,
rtnl_filter_t
junk
,
rtnl_filter_t
junk
,
void
*
jarg
);
void
*
jarg
);
extern
int
rtnl_send
(
struct
rtnl_handle
*
rth
,
const
char
*
buf
,
int
);
extern
int
rtnl_send
(
struct
rtnl_handle
*
rth
,
const
void
*
buf
,
int
);
extern
int
rtnl_send_check
(
struct
rtnl_handle
*
rth
,
const
char
*
buf
,
int
);
extern
int
rtnl_send_check
(
struct
rtnl_handle
*
rth
,
const
void
*
buf
,
int
);
extern
int
addattr32
(
struct
nlmsghdr
*
n
,
int
maxlen
,
int
type
,
__u32
data
);
extern
int
addattr32
(
struct
nlmsghdr
*
n
,
int
maxlen
,
int
type
,
__u32
data
);
extern
int
addattr_l
(
struct
nlmsghdr
*
n
,
int
maxlen
,
int
type
,
const
void
*
data
,
int
alen
);
extern
int
addattr_l
(
struct
nlmsghdr
*
n
,
int
maxlen
,
int
type
,
const
void
*
data
,
int
alen
);
...
...
ip/iplink.c
View file @
6cf8398f
...
@@ -164,7 +164,7 @@ static int iplink_have_newlink(void)
...
@@ -164,7 +164,7 @@ static int iplink_have_newlink(void)
req
.
n
.
nlmsg_type
=
RTM_NEWLINK
;
req
.
n
.
nlmsg_type
=
RTM_NEWLINK
;
req
.
i
.
ifi_family
=
AF_UNSPEC
;
req
.
i
.
ifi_family
=
AF_UNSPEC
;
rtnl_send
(
&
rth
,
(
char
*
)
&
req
.
n
,
req
.
n
.
nlmsg_len
);
rtnl_send
(
&
rth
,
&
req
.
n
,
req
.
n
.
nlmsg_len
);
rtnl_listen
(
&
rth
,
accept_msg
,
NULL
);
rtnl_listen
(
&
rth
,
accept_msg
,
NULL
);
}
}
return
have_rtnl_newlink
;
return
have_rtnl_newlink
;
...
...
lib/libnetlink.c
View file @
6cf8398f
...
@@ -107,12 +107,12 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
...
@@ -107,12 +107,12 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
return
send
(
rth
->
fd
,
(
void
*
)
&
req
,
sizeof
(
req
),
0
);
return
send
(
rth
->
fd
,
(
void
*
)
&
req
,
sizeof
(
req
),
0
);
}
}
int
rtnl_send
(
struct
rtnl_handle
*
rth
,
const
char
*
buf
,
int
len
)
int
rtnl_send
(
struct
rtnl_handle
*
rth
,
const
void
*
buf
,
int
len
)
{
{
return
send
(
rth
->
fd
,
buf
,
len
,
0
);
return
send
(
rth
->
fd
,
buf
,
len
,
0
);
}
}
int
rtnl_send_check
(
struct
rtnl_handle
*
rth
,
const
char
*
buf
,
int
len
)
int
rtnl_send_check
(
struct
rtnl_handle
*
rth
,
const
void
*
buf
,
int
len
)
{
{
struct
nlmsghdr
*
h
;
struct
nlmsghdr
*
h
;
int
status
;
int
status
;
...
@@ -148,7 +148,7 @@ int rtnl_send_check(struct rtnl_handle *rth, const char *buf, int len)
...
@@ -148,7 +148,7 @@ int rtnl_send_check(struct rtnl_handle *rth, const char *buf, int len)
int
rtnl_dump_request
(
struct
rtnl_handle
*
rth
,
int
type
,
void
*
req
,
int
len
)
int
rtnl_dump_request
(
struct
rtnl_handle
*
rth
,
int
type
,
void
*
req
,
int
len
)
{
{
struct
nlmsghdr
nlh
;
struct
nlmsghdr
nlh
;
struct
sockaddr_nl
nladdr
;
struct
sockaddr_nl
nladdr
=
{
.
nl_family
=
AF_NETLINK
}
;
struct
iovec
iov
[
2
]
=
{
struct
iovec
iov
[
2
]
=
{
{
.
iov_base
=
&
nlh
,
.
iov_len
=
sizeof
(
nlh
)
},
{
.
iov_base
=
&
nlh
,
.
iov_len
=
sizeof
(
nlh
)
},
{
.
iov_base
=
req
,
.
iov_len
=
len
}
{
.
iov_base
=
req
,
.
iov_len
=
len
}
...
@@ -160,9 +160,6 @@ int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len)
...
@@ -160,9 +160,6 @@ int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len)
.
msg_iovlen
=
2
,
.
msg_iovlen
=
2
,
};
};
memset
(
&
nladdr
,
0
,
sizeof
(
nladdr
));
nladdr
.
nl_family
=
AF_NETLINK
;
nlh
.
nlmsg_len
=
NLMSG_LENGTH
(
len
);
nlh
.
nlmsg_len
=
NLMSG_LENGTH
(
len
);
nlh
.
nlmsg_type
=
type
;
nlh
.
nlmsg_type
=
type
;
nlh
.
nlmsg_flags
=
NLM_F_ROOT
|
NLM_F_MATCH
|
NLM_F_REQUEST
;
nlh
.
nlmsg_flags
=
NLM_F_ROOT
|
NLM_F_MATCH
|
NLM_F_REQUEST
;
...
...
misc/arpd.c
View file @
6cf8398f
...
@@ -281,7 +281,7 @@ int respond_to_kernel(int ifindex, __u32 addr, char *lla, int llalen)
...
@@ -281,7 +281,7 @@ int respond_to_kernel(int ifindex, __u32 addr, char *lla, int llalen)
addattr_l
(
&
req
.
n
,
sizeof
(
req
),
NDA_DST
,
&
addr
,
4
);
addattr_l
(
&
req
.
n
,
sizeof
(
req
),
NDA_DST
,
&
addr
,
4
);
addattr_l
(
&
req
.
n
,
sizeof
(
req
),
NDA_LLADDR
,
lla
,
llalen
);
addattr_l
(
&
req
.
n
,
sizeof
(
req
),
NDA_LLADDR
,
lla
,
llalen
);
return
rtnl_send
(
&
rth
,
(
char
*
)
&
req
,
req
.
n
.
nlmsg_len
)
<=
0
;
return
rtnl_send
(
&
rth
,
&
req
,
req
.
n
.
nlmsg_len
)
<=
0
;
}
}
void
prepare_neg_entry
(
__u8
*
ndata
,
__u32
stamp
)
void
prepare_neg_entry
(
__u8
*
ndata
,
__u32
stamp
)
...
...
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