Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
b6f0f0ed
Commit
b6f0f0ed
authored
Jan 19, 2006
by
Junxing Zhang
Browse files
add sniff_interface as an input argument to pcapd
parent
bfd6114e
Changes
3
Hide whitespace changes
Inline
Side-by-side
pelab/stub/stub-pcap.c
View file @
b6f0f0ed
...
...
@@ -398,8 +398,11 @@ void init_pcap(int to_ms) {
char
string_filter
[
128
];
//struct in_addr addr;
// dev = "vnet"; //"eth0"; //
dev
=
"eth1"
;
dev
=
sniff_interface
;
//input parameter of stubd, should be "vnet" or "eth0"
if
(
flag_debug
)
{
printf
(
"The sniff_interface: %s
\n
"
,
sniff_interface
);
}
/* ask pcap for the network address and mask of the device */
pcap_lookupnet
(
dev
,
&
netp
,
&
maskp
,
errbuf
);
//For an unknown reason, netp has the wrong 4th number
...
...
pelab/stub/stub.h
View file @
b6f0f0ed
...
...
@@ -73,6 +73,7 @@ typedef struct loss_record loss_record;
extern
short
flag_debug
;
extern
int
pcapfd
;
extern
char
sniff_interface
[
128
];
extern
connection
rcvdb
[
CONCURRENT_RECEIVERS
];
extern
sniff_path
sniff_rcvdb
[
CONCURRENT_RECEIVERS
];
extern
unsigned
long
delays
[
CONCURRENT_RECEIVERS
];
//delay is calculated at the sender side
...
...
pelab/stub/stubd.c
View file @
b6f0f0ed
...
...
@@ -13,6 +13,7 @@ void clean_exit(int);
//Global
short
flag_debug
;
char
sniff_interface
[
128
];
connection
rcvdb
[
CONCURRENT_RECEIVERS
];
unsigned
long
delays
[
CONCURRENT_RECEIVERS
];
//delay is calculated at the sender side
unsigned
long
last_delays
[
CONCURRENT_RECEIVERS
];
...
...
@@ -514,7 +515,7 @@ int have_time(struct timeval *start_tvp, struct timeval *left_tvp){
return
0
;
}
int
main
(
void
)
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
int
sockfd_snd
,
sockfd_rcv_sender
,
sockfd_rcv_monitor
,
sockfd_monitor
=-
1
;
struct
sockaddr_in
my_addr
;
// my address information
struct
sockaddr_in
their_addr
;
// connector's address information
...
...
@@ -532,6 +533,18 @@ int main(void) {
else
flag_debug
=
0
;
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"Usage: stubd <sniff-interface>
\n
"
);
exit
(
1
);
}
if
(
strlen
(
argv
[
1
])
>
127
)
{
fprintf
(
stderr
,
"Error: the <sniff-interface> name must be less than 127 characters
\n
"
);
exit
(
1
);
}
strcpy
(
sniff_interface
,
argv
[
1
]);
//set up the sender connection listener
if
((
sockfd_rcv_sender
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
-
1
)
{
perror
(
"socket"
);
...
...
Write
Preview
Supports
Markdown
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