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
b5278b00
Commit
b5278b00
authored
Apr 18, 2003
by
Mike Hibler
Browse files
changes to support setting of IP_TOS bits
parent
ba2c7d35
Changes
2
Hide whitespace changes
Inline
Side-by-side
event/trafgen/event.c
View file @
b5278b00
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-200
2
University of Utah and the Flux Group.
* Copyright (c) 2000-200
3
University of Utah and the Flux Group.
* All rights reserved.
*/
...
...
@@ -280,11 +280,12 @@ parse_args(char *buf, tg_action *tg)
static
int
currate
=
-
1
;
static
int
curpsize
=
DEFAULT_PKT_SIZE
;
static
double
curinterval
=
DEFAULT_INTERVAL
;
int
psize
,
rate
;
static
int
curqos
=
-
1
;
int
psize
,
rate
,
qos
;
double
interval
;
char
*
cp
;
psize
=
rate
=
-
1
;
psize
=
rate
=
qos
=
-
1
;
interval
=
-
1
.
0
;
/*
...
...
@@ -301,6 +302,9 @@ parse_args(char *buf, tg_action *tg)
if
(
sscanf
(
cp
,
"RATE=%d"
,
&
rate
)
==
1
)
continue
;
if
(
sscanf
(
cp
,
"QOS=%d"
,
&
qos
)
==
1
)
continue
;
}
}
...
...
@@ -348,19 +352,31 @@ parse_args(char *buf, tg_action *tg)
return
(
EINVAL
);
}
/*
* Check QOS value
*/
if
(
qos
==
-
1
)
qos
=
curqos
;
/*
* Finally, record the new values.
*/
dist_const_init
(
&
tg
->
arrival
,
interval
);
dist_const_init
(
&
tg
->
length
,
(
double
)
psize
);
tg
->
tg_flags
|=
(
TG_ARRIVAL
|
TG_LENGTH
);
if
(
qos
!=
-
1
)
{
prot
.
tos
=
qos
;
prot
.
qos
|=
QOS_TOS
;
}
else
prot
.
qos
&=
~
QOS_TOS
;
curinterval
=
interval
;
curpsize
=
psize
;
currate
=
rate
;
curqos
=
qos
;
#if 0
fprintf(stderr, "parse_args: new psize=%d, interval=%.9f\n",
psize, interval);
fprintf(stderr, "parse_args: new psize=%d, interval=%.9f
, qos=%d
\n",
psize, interval
, qos
);
#endif
return
(
0
);
...
...
event/trafgen/tg.patch
View file @
b5278b00
Only in tg2.0/src/tg: #prot_tcp.c#
diff -ru dist-tg2.0/src/tg/config.h tg2.0/src/tg/config.h
--- dist-tg2.0/src/tg/config.h Thu Jan 24 16:30:09 2002
+++ tg2.0/src/tg/config.h Mon Jul 8 14:46:06 2002
...
...
@@ -242,8 +243,36 @@ diff -ru dist-tg2.0/src/tg/prot_stream.c tg2.0/src/tg/prot_stream.c
}
diff -ru dist-tg2.0/src/tg/prot_tcp.c tg2.0/src/tg/prot_tcp.c
--- dist-tg2.0/src/tg/prot_tcp.c Thu Jan 24 16:30:10 2002
+++ tg2.0/src/tg/prot_tcp.c Mon Jul 8 14:46:06 2002
@@ -184,7 +184,24 @@
+++ tg2.0/src/tg/prot_tcp.c Fri Apr 18 13:36:45 2003
@@ -93,6 +93,12 @@
#endif /* QOSDEBUG */
+#ifndef SUNOS4
+ if ((prot->qos & QOS_TOS) != 0)
+ if (setsockopt(fd, IPPROTO_IP, IP_TOS, (char *)(&(prot->tos)),
+ sizeof(prot->tos)) == -1)
+ perror("tcp_setup: can't set TOS");
+#endif
if ((prot->qos & QOS_RCVWIN) != 0)
{
@@ -165,14 +171,6 @@
return(-1);
}
/* handle any QOS parameters */
-#ifndef SUNOS4
- if ((prot->qos & QOS_TOS) != 0)
- /* Set IP tos */
- if (setsockopt(sfd, IPPROTO_IP, IP_TOS, (char *)(&(prot->tos)),
- sizeof(prot->tos)) == -1)
- perror("tcp_setup: can't set TOS");
-#endif
-
tcp_qos(sfd);
tmpaddr = (struct sockaddr_in *)&(prot->dst);
@@ -184,7 +182,24 @@
return (-1);
}
...
...
@@ -269,7 +298,7 @@ diff -ru dist-tg2.0/src/tg/prot_tcp.c tg2.0/src/tg/prot_tcp.c
(errno != EINPROGRESS))
{
(void)close(sfd);
@@ -217,6 +23
4
,13 @@
@@ -217,6 +23
2
,13 @@
return (-1);
}
...
...
@@ -296,7 +325,16 @@ diff -ru dist-tg2.0/src/tg/prot_test.c tg2.0/src/tg/prot_test.c
else
diff -ru dist-tg2.0/src/tg/prot_udp.c tg2.0/src/tg/prot_udp.c
--- dist-tg2.0/src/tg/prot_udp.c Thu Jan 24 16:30:10 2002
+++ tg2.0/src/tg/prot_udp.c Mon Jul 8 14:46:06 2002
+++ tg2.0/src/tg/prot_udp.c Fri Apr 18 13:53:15 2003
@@ -47,7 +47,7 @@
/* Apply QOS parameters to an existing fd. */
-static void udp_qos(fd, prot)
+void udp_qos(fd, prot)
int fd;
protocol *prot;
{
@@ -199,13 +199,20 @@
if (prot->qos & QOS_SRC)
...
...
@@ -344,7 +382,7 @@ diff -ru dist-tg2.0/src/tg/prot_udp.c tg2.0/src/tg/prot_udp.c
(void)close(sfd);
diff -ru dist-tg2.0/src/tg/tg.y tg2.0/src/tg/tg.y
--- dist-tg2.0/src/tg/tg.y Thu Jan 24 16:30:10 2002
+++ tg2.0/src/tg/tg.y
Tue Jan 7
13:
07
:44 2003
+++ tg2.0/src/tg/tg.y
Fri Apr 18
13:
52
:44 2003
@@ -133,7 +133,11 @@
char *version = "2.0"; /* TG program version. */
char *ofile = NULL;
...
...
@@ -427,18 +465,30 @@ diff -ru dist-tg2.0/src/tg/tg.y tg2.0/src/tg/tg.y
{
/* (Re-)Start logging to a new file */
time_t now;
@@ -1144,6 +1160,
10
@@
@@ -1144,6 +1160,
22
@@
generate(tx_asn, cur_tg, lasttime);
}
+#ifdef USEEVENTS
+ if (gotevent)
+ {
+ if (prot.qos & QOS_TOS)
+ {
+ /* XXX should be in proto table */
+ extern long tcp_setup(), udp_setup();
+ extern void tcp_qos(), udp_qos();
+ if (prot.prot->setup == tcp_setup)
+ tcp_qos(tx_asn);
+ else if (prot.prot->setup == udp_setup)
+ udp_qos(tx_asn);
+ }
+ goto restart;
+ }
+#endif
}
/* Finished, tear down connection. */
@@ -1154,8 +11
74
,11 @@
@@ -1154,8 +11
86
,11 @@
/* log the teardown error. */
perror("do_actions: protocol teardown");
...
...
@@ -450,7 +500,7 @@ diff -ru dist-tg2.0/src/tg/tg.y tg2.0/src/tg/tg.y
return;
}
@@ -1341,6 +136
4
,12 @@
@@ -1341,6 +13
7
6,12 @@
if (arrival != 0)
(*(prot.prot->sleep_till))(&nextpkt_tv);
...
...
@@ -463,7 +513,7 @@ diff -ru dist-tg2.0/src/tg/tg.y tg2.0/src/tg/tg.y
lasttime = nextpkt_tv;
/* Did we exceed the limit on the number of packets to send? */
@@ -1382,6 +14
11
,10 @@
@@ -1382,6 +14
23
,10 @@
pktlen,
&(cur_tg->stop_before),
&pktid);
...
...
@@ -474,7 +524,7 @@ diff -ru dist-tg2.0/src/tg/tg.y tg2.0/src/tg/tg.y
}
}
}
@@ -2096,5 +21
29
,16 @@
@@ -2096,5 +21
41
,16 @@
char *addr;
{
...
...
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