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
4c0d54fc
Commit
4c0d54fc
authored
Jan 11, 2006
by
Junxing Zhang
Browse files
stub files for Plab
parent
5e78b7a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
pelab/stub/Makefile
View file @
4c0d54fc
...
...
@@ -2,7 +2,7 @@ all: stubd stub-monitor
stubd
:
stubd.o stub-pcap.o stub.h
gcc
-g
-Wall
-lm
-lpcap
stubd.o stub-pcap.o
-o
stubd
monitor
-
stub
:
monitor
-stub
.c stub.h
stub-
monitor
:
stub
-
monitor.c stub.h
gcc
-g
-Wall
stub-monitor.c
-o
stub-monitor
stubd.o
:
stubd.c stub.h
gcc
-g
-Wall
-c
stubd.c
...
...
pelab/stub/stub-pcap.c
View file @
4c0d54fc
...
...
@@ -103,6 +103,7 @@ int search_sniff_rcvdb(int path_id, u_long seqnum) {
void
pop_sniff_rcvdb
(
int
path_id
,
u_long
to_seqnum
){
int
to_index
=
search_sniff_rcvdb
(
path_id
,
to_seqnum
);
if
(
to_index
!=
-
1
)
{
//if the packet has no payload or the last sent seqnum equals the pop number
if
((
sniff_rcvdb
[
path_id
].
records
[
to_index
].
seq_end
==
sniff_rcvdb
[
path_id
].
records
[
to_index
].
seq_start
)
||
(
sniff_rcvdb
[
path_id
].
records
[
to_index
].
seq_end
-
1
==
to_seqnum
))
{
sniff_rcvdb
[
path_id
].
start
=
(
to_index
+
1
)
%
SNIFF_WINSIZE
;
//complete pop-up
...
...
@@ -181,7 +182,7 @@ u_int16_t handle_IP(u_char *args, const struct pcap_pkthdr* pkthdr, const u_char
ip_dst
=
ip
->
ip_dst
.
s_addr
;
if
(
flag_debug
){
//
For an unknown reason,
inet_ntoa returns the same string if called twice in one
fprintf
//
Note:
inet_ntoa returns the same string if called twice in one
line due to static string buffer
fprintf
(
stdout
,
"IP src:%s "
,
inet_ntoa
(
ip
->
ip_src
));
fprintf
(
stdout
,
"dst:%s hlen:%d version:%d len:%d
\n
"
,
inet_ntoa
(
ip
->
ip_dst
),
hlen
,
version
,
len
);
}
...
...
@@ -327,7 +328,7 @@ void init_pcap(int to_ms) {
char
string_filter
[
128
];
//struct in_addr addr;
dev
=
"et
h0
"
;
//"
vn
et";
dev
=
"
vn
et"
;
//"et
h0
";
/* ask pcap for the network address and mask of the device */
pcap_lookupnet
(
dev
,
&
netp
,
&
maskp
,
errbuf
);
...
...
pelab/stub/stubd.c
View file @
4c0d54fc
...
...
@@ -232,7 +232,11 @@ int receive_monitor(int sockfd) {
memcpy
(
&
tmpulong
,
nextptr
,
SIZEOF_LONG
);
destnum
=
ntohl
(
tmpulong
);
//receive dest addrs
//return success if no dest addr is given
if
(
destnum
==
0
){
return
1
;
}
//otherwise, receive dest addrs
if
(
recv_all
(
sockfd
,
buf
,
destnum
*
SIZEOF_LONG
)
==
0
)
{
return
0
;
}
...
...
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