git: 277b9588fde6 - main - ifconfig: add rxtls and -rxtls commands

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 24 May 2022 20:59:53 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=277b9588fde66850171e013051d79737a01c3de9

commit 277b9588fde66850171e013051d79737a01c3de9
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-12-15 03:06:08 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-05-24 20:59:33 +0000

    ifconfig: add rxtls and -rxtls commands
    
    Reviewed by:    hselasky, jhb, kp
    Sponsored by:   NVIDIA Networking
    MFC after:      3 weeks
    Differential revision:  https://reviews.freebsd.org/D32551
---
 sbin/ifconfig/ifconfig.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 9ee86b2a5169..2ed7d43ac50c 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1280,7 +1280,12 @@ setifcapnv(const char *vname, const char *arg, int s, const struct afswtch *afp)
 		neg = *mopt == '-';
 		if (neg)
 			mopt++;
-		nvlist_add_bool(nvcap, mopt, !neg);
+		if (strcmp(mopt, "rxtls") == 0) {
+			nvlist_add_bool(nvcap, "rxtls4", !neg);
+			nvlist_add_bool(nvcap, "rxtls6", !neg);
+		} else {
+			nvlist_add_bool(nvcap, mopt, !neg);
+		}
 	}
 	buf = nvlist_pack(nvcap, &nvbuflen);
 	if (buf == NULL) {
@@ -1739,6 +1744,10 @@ static struct cmd basic_cmds[] = {
 	DEF_CMD("-lro",		-IFCAP_LRO,	setifcap),
 	DEF_CMD("txtls",	IFCAP_TXTLS,	setifcap),
 	DEF_CMD("-txtls",	-IFCAP_TXTLS,	setifcap),
+	DEF_CMD_SARG("rxtls",	IFCAP2_RXTLS4_NAME "," IFCAP2_RXTLS6_NAME,
+	    setifcapnv),
+	DEF_CMD_SARG("-rxtls",	"-"IFCAP2_RXTLS4_NAME ",-" IFCAP2_RXTLS6_NAME,
+	    setifcapnv),
 	DEF_CMD("wol",		IFCAP_WOL,	setifcap),
 	DEF_CMD("-wol",		-IFCAP_WOL,	setifcap),
 	DEF_CMD("wol_ucast",	IFCAP_WOL_UCAST,	setifcap),