Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
e135ba06
Commit
e135ba06
authored
Jan 23, 2015
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/ptpdump: change main() to dump vlans
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
217be676
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
dump-main.c
tools/dump-main.c
+11
-2
No files found.
tools/dump-main.c
View file @
e135ba06
...
...
@@ -89,6 +89,7 @@ int main(int argc, char **argv)
/* Ok, now we are promiscuous. Just read stuff forever */
while
(
1
)
{
struct
ethhdr
*
eth
;
struct
pp_vlanhdr
*
vhdr
;
struct
iphdr
*
ip
;
static
unsigned
char
prev
[
1500
];
static
int
prevlen
;
...
...
@@ -98,7 +99,7 @@ int main(int argc, char **argv)
struct
sockaddr_in
from
;
socklen_t
fromlen
=
sizeof
(
from
);
int
len
;
int
len
,
proto
;
len
=
recvfrom
(
sock
,
buf
,
sizeof
(
buf
),
MSG_TRUNC
,
(
struct
sockaddr
*
)
&
from
,
&
fromlen
);
...
...
@@ -120,7 +121,15 @@ int main(int argc, char **argv)
continue
;
eth
=
(
void
*
)
buf
;
ip
=
(
void
*
)(
buf
+
ETH_HLEN
);
switch
(
ntohs
(
eth
->
h_proto
))
{
proto
=
ntohs
(
eth
->
h_proto
);
if
(
proto
==
0x8100
)
{
/* VLAN is visible (e.g.: outgoing) */
vhdr
=
(
void
*
)
buf
;
proto
=
ntohs
(
vhdr
->
h_proto
);
ip
=
(
void
*
)(
buf
+
sizeof
(
*
vhdr
));
}
switch
(
proto
)
{
case
ETH_P_IP
:
{
struct
udphdr
*
udp
=
(
void
*
)(
ip
+
1
);
...
...
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