Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
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
bcc
Commits
e9fa659e
Commit
e9fa659e
authored
Oct 06, 2017
by
Prashant Bhole
Committed by
Brenden Blanco
Oct 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libbpf: return error when if_nametoindex returns 0
sll_ifindex=0 matches any interface, which is not exepected here
parent
7c9d8c93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
src/cc/libbpf.c
src/cc/libbpf.c
+5
-0
No files found.
src/cc/libbpf.c
View file @
e9fa659e
...
...
@@ -432,6 +432,11 @@ int bpf_open_raw_sock(const char *name)
memset
(
&
sll
,
0
,
sizeof
(
sll
));
sll
.
sll_family
=
AF_PACKET
;
sll
.
sll_ifindex
=
if_nametoindex
(
name
);
if
(
sll
.
sll_ifindex
==
0
)
{
fprintf
(
stderr
,
"bpf: Resolving device name to index: %s
\n
"
,
strerror
(
errno
));
close
(
sock
);
return
-
1
;
}
sll
.
sll_protocol
=
htons
(
ETH_P_ALL
);
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
sll
,
sizeof
(
sll
))
<
0
)
{
printf
(
"bind to %s: %s
\n
"
,
name
,
strerror
(
errno
));
...
...
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