Page MenuHomeFreeBSD

D26384.diff
No OneTemporary

D26384.diff

Index: head/sbin/ping6/ping6.8
===================================================================
--- head/sbin/ping6/ping6.8
+++ head/sbin/ping6/ping6.8
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 20, 2019
+.Dd September 10, 2020
.Dt PING6 8
.Os
.Sh NAME
@@ -87,6 +87,9 @@
.Op Fl W Ar waittime
.Ek
.Bk -words
+.Op Fl z Ar tclass
+.Ek
+.Bk -words
.Op Ar hops ...
.Ek
.Bk -words
@@ -329,6 +332,8 @@
has no effect if
.Fl y
is specified.
+.It Fl z Ar tclass
+Use the specified traffic class when sending.
.It Ar hops
IPv6 addresses for intermediate nodes,
which will be put into type 0 routing header.
Index: head/sbin/ping6/ping6.c
===================================================================
--- head/sbin/ping6/ping6.c
+++ head/sbin/ping6/ping6.c
@@ -229,6 +229,7 @@
static int ident; /* process id to identify our packets */
static u_int8_t nonce[8]; /* nonce field for node information */
static int hoplimit = -1; /* hoplimit */
+static int tclass = -1; /* traffic class */
static u_char *packet = NULL;
static cap_channel_t *capdns;
@@ -352,7 +353,7 @@
#endif /*IPSEC_POLICY_IPSEC*/
#endif
while ((ch = getopt(argc, argv,
- "k:b:c:DdfHe:m:I:i:l:unNop:qaAS:s:OvyYW:t:" ADDOPTS)) != -1) {
+ "k:b:c:DdfHe:m:I:i:l:unNop:qaAS:s:OvyYW:t:z:" ADDOPTS)) != -1) {
#undef ADDOPTS
switch (ch) {
case 'k':
@@ -585,6 +586,14 @@
err(1, "setitimer");
}
break;
+ case 'z': /* traffic class */
+ tclass = strtol(optarg, &e, 10);
+ if (*optarg == '\0' || *e != '\0')
+ errx(1, "illegal traffic class %s", optarg);
+ if (255 < tclass || tclass < -1)
+ errx(1,
+ "illegal traffic class -- %s", optarg);
+ break;
#ifdef IPSEC
#ifdef IPSEC_POLICY_IPSEC
case 'P':
@@ -935,6 +944,12 @@
memcpy(CMSG_DATA(scmsgp), &hoplimit, sizeof(hoplimit));
scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
+ }
+
+ if (tclass != -1) {
+ if (setsockopt(ssend, IPPROTO_IPV6, IPV6_TCLASS,
+ &tclass, sizeof(tclass)) == -1)
+ err(1, "setsockopt(IPV6_TCLASS)");
}
if (argc > 1) { /* some intermediate addrs are specified */

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 2, 3:44 AM (18 m, 18 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29139648
Default Alt Text
D26384.diff (2 KB)

Event Timeline