Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 May 2002 16:56:49 -0700 (PDT)
From:      Adam Migus <amigus@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 11071 for review
Message-ID:  <200205092356.g49Nunp88435@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11071

Change 11071 by amigus@amigus_ganymede on 2002/05/09 16:56:18

	Added SO_LABEL and SO_PEERLABEL to getsockopt() (SOL_SOCKET),
	to retrieve the label and peer label respectively.  This kind
	of makes the mac_get_socket(), and mac_get_peer() calls
	redundant.  But everyone likes redundant code thats redundant
	right?  :-)  setsockopt() coming soon.

Affected files ...

... //depot/projects/trustedbsd/mac/sys/kern/uipc_socket.c#19 edit
... //depot/projects/trustedbsd/mac/sys/sys/socket.h#5 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/uipc_socket.c#19 (text+ko) ====

@@ -1333,6 +1333,9 @@
 #ifdef INET
 	struct accept_filter_arg *afap;
 #endif
+#ifdef MAC
+	struct mac *label;
+#endif /* MAC */
 
 	error = 0;
 	if (sopt->sopt_level != SOL_SOCKET) {
@@ -1413,7 +1416,14 @@
 			tv.tv_usec = (optval % hz) * tick;
 			error = sooptcopyout(sopt, &tv, sizeof tv);
 			break;
-
+#ifdef MAC
+		case SO_LABEL:
+		case SO_PEERLABEL:
+			label = (sopt->sopt_name == SO_LABEL ?
+				  &so->so_label : &so->so_peerlabel);
+			error = sooptcopyout(sopt, label, sizeof *label);
+			break;
+#endif /* MAC */
 		default:
 			error = ENOPROTOOPT;
 			break;

==== //depot/projects/trustedbsd/mac/sys/sys/socket.h#5 (text+ko) ====

@@ -96,6 +96,8 @@
 #define	SO_ERROR	0x1007		/* get error status and clear */
 #define	SO_TYPE		0x1008		/* get socket type */
 /*efine	SO_PRIVSTATE	0x1009		   get/deny privileged state */
+#define SO_LABEL        0x1010          /* sockets MAC label */
+#define SO_PEERLABEL    0x1011          /* sockets peer MAC label */
 
 /*
  * Structure used for manipulating linger option.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205092356.g49Nunp88435>