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
007d3a3e
Commit
007d3a3e
authored
Aug 13, 2004
by
osdl.net!shemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bigger send/receive buf.
(Logical change 1.66)
parent
fa426214
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
lib/libnetlink.c
lib/libnetlink.c
+29
-6
No files found.
lib/libnetlink.c
View file @
007d3a3e
...
...
@@ -33,6 +33,8 @@ void rtnl_close(struct rtnl_handle *rth)
int
rtnl_open_byproto
(
struct
rtnl_handle
*
rth
,
unsigned
subscriptions
,
int
protocol
)
{
int
addr_len
;
int
sndbuf
=
32768
;
int
rcvbuf
=
32768
;
memset
(
rth
,
0
,
sizeof
(
rth
));
...
...
@@ -42,6 +44,16 @@ int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions, int proto
return
-
1
;
}
if
(
setsockopt
(
rth
->
fd
,
SOL_SOCKET
,
SO_SNDBUF
,
&
sndbuf
,
sizeof
(
sndbuf
))
<
0
)
{
perror
(
"SO_SNDBUF"
);
return
-
1
;
}
if
(
setsockopt
(
rth
->
fd
,
SOL_SOCKET
,
SO_RCVBUF
,
&
rcvbuf
,
sizeof
(
rcvbuf
))
<
0
)
{
perror
(
"SO_RCVBUF"
);
return
-
1
;
}
memset
(
&
rth
->
local
,
0
,
sizeof
(
rth
->
local
));
rth
->
local
.
nl_family
=
AF_NETLINK
;
rth
->
local
.
nl_groups
=
subscriptions
;
...
...
@@ -133,7 +145,7 @@ int rtnl_dump_filter(struct rtnl_handle *rth,
int
(
*
junk
)(
struct
sockaddr_nl
*
,
struct
nlmsghdr
*
n
,
void
*
),
void
*
arg2
)
{
char
buf
[
8192
];
char
buf
[
16384
];
struct
sockaddr_nl
nladdr
;
struct
iovec
iov
=
{
buf
,
sizeof
(
buf
)
};
...
...
@@ -220,7 +232,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
struct
nlmsghdr
*
h
;
struct
sockaddr_nl
nladdr
;
struct
iovec
iov
=
{
(
void
*
)
n
,
n
->
nlmsg_len
};
char
buf
[
8192
];
char
buf
[
16384
];
struct
msghdr
msg
=
{
(
void
*
)
&
nladdr
,
sizeof
(
nladdr
),
&
iov
,
1
,
...
...
@@ -234,6 +246,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
nladdr
.
nl_groups
=
groups
;
n
->
nlmsg_seq
=
seq
=
++
rtnl
->
seq
;
if
(
answer
==
NULL
)
n
->
nlmsg_flags
|=
NLM_F_ACK
;
...
...
@@ -244,6 +257,8 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
return
-
1
;
}
memset
(
buf
,
0
,
sizeof
(
buf
));
iov
.
iov_base
=
buf
;
while
(
1
)
{
...
...
@@ -459,8 +474,10 @@ int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data)
{
int
len
=
RTA_LENGTH
(
4
);
struct
rtattr
*
rta
;
if
(
NLMSG_ALIGN
(
n
->
nlmsg_len
)
+
len
>
maxlen
)
if
(
NLMSG_ALIGN
(
n
->
nlmsg_len
)
+
len
>
maxlen
)
{
fprintf
(
stderr
,
"addattr32: Error! max allowed bound %d exceeded
\n
"
,
maxlen
);
return
-
1
;
}
rta
=
(
struct
rtattr
*
)(((
char
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
));
rta
->
rta_type
=
type
;
rta
->
rta_len
=
len
;
...
...
@@ -474,8 +491,10 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
int
len
=
RTA_LENGTH
(
alen
);
struct
rtattr
*
rta
;
if
(
NLMSG_ALIGN
(
n
->
nlmsg_len
)
+
len
>
maxlen
)
if
(
NLMSG_ALIGN
(
n
->
nlmsg_len
)
+
len
>
maxlen
)
{
fprintf
(
stderr
,
"addattr_l ERROR: message exceeded bound of %d
\n
"
,
maxlen
);
return
-
1
;
}
rta
=
(
struct
rtattr
*
)(((
char
*
)
n
)
+
NLMSG_ALIGN
(
n
->
nlmsg_len
));
rta
->
rta_type
=
type
;
rta
->
rta_len
=
len
;
...
...
@@ -489,8 +508,10 @@ int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data)
int
len
=
RTA_LENGTH
(
4
);
struct
rtattr
*
subrta
;
if
(
RTA_ALIGN
(
rta
->
rta_len
)
+
len
>
maxlen
)
if
(
RTA_ALIGN
(
rta
->
rta_len
)
+
len
>
maxlen
)
{
fprintf
(
stderr
,
"rta_addattr32: Error! max allowed bound %d exceeded
\n
"
,
maxlen
);
return
-
1
;
}
subrta
=
(
struct
rtattr
*
)(((
char
*
)
rta
)
+
RTA_ALIGN
(
rta
->
rta_len
));
subrta
->
rta_type
=
type
;
subrta
->
rta_len
=
len
;
...
...
@@ -504,8 +525,10 @@ int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen
struct
rtattr
*
subrta
;
int
len
=
RTA_LENGTH
(
alen
);
if
(
RTA_ALIGN
(
rta
->
rta_len
)
+
len
>
maxlen
)
if
(
RTA_ALIGN
(
rta
->
rta_len
)
+
len
>
maxlen
)
{
fprintf
(
stderr
,
"rta_addattr_l: Error! max allowed bound %d exceeded
\n
"
,
maxlen
);
return
-
1
;
}
subrta
=
(
struct
rtattr
*
)(((
char
*
)
rta
)
+
RTA_ALIGN
(
rta
->
rta_len
));
subrta
->
rta_type
=
type
;
subrta
->
rta_len
=
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