From owner-p4-projects Thu May 9 16:57:21 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5D55337B407; Thu, 9 May 2002 16:56:58 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E21DE37B404 for ; Thu, 9 May 2002 16:56:49 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g49Nunp88435 for perforce@freebsd.org; Thu, 9 May 2002 16:56:49 -0700 (PDT) (envelope-from amigus@tislabs.com) Date: Thu, 9 May 2002 16:56:49 -0700 (PDT) Message-Id: <200205092356.g49Nunp88435@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to amigus@tislabs.com using -f From: Adam Migus Subject: PERFORCE change 11071 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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