aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlabel/netlabel_kapi.c
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2008-10-10 10:16:32 -0400
committerPaul Moore <paul.moore@hp.com>2008-10-10 10:16:32 -0400
commit63c41688743760631188cf0f4ae986a6793ccb0a (patch)
treeb270091d7b763e8b6c5073d4ca618f0d36065188 /net/netlabel/netlabel_kapi.c
parent61e1068219950c672ce979719ad2be3aadb00d7d (diff)
netlabel: Add network address selectors to the NetLabel/LSM domain mapping
This patch extends the NetLabel traffic labeling capabilities to individual packets based not only on the LSM domain but the by the destination address as well. The changes here only affect the core NetLabel infrastructre, changes to the NetLabel KAPI and individial protocol engines are also required but are split out into a different patch to ease review. Signed-off-by: Paul Moore <paul.moore@hp.com> Reviewed-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'net/netlabel/netlabel_kapi.c')
-rw-r--r--net/netlabel/netlabel_kapi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 7d8ecea93914..8b820dc98060 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -419,7 +419,9 @@ int netlbl_enabled(void)
419 * Attach the correct label to the given socket using the security attributes 419 * Attach the correct label to the given socket using the security attributes
420 * specified in @secattr. This function requires exclusive access to @sk, 420 * specified in @secattr. This function requires exclusive access to @sk,
421 * which means it either needs to be in the process of being created or locked. 421 * which means it either needs to be in the process of being created or locked.
422 * Returns zero on success, negative values on failure. 422 * Returns zero on success, -EDESTADDRREQ if the domain is configured to use
423 * network address selectors (can't blindly label the socket), and negative
424 * values on all other failures.
423 * 425 *
424 */ 426 */
425int netlbl_sock_setattr(struct sock *sk, 427int netlbl_sock_setattr(struct sock *sk,
@@ -433,6 +435,9 @@ int netlbl_sock_setattr(struct sock *sk,
433 if (dom_entry == NULL) 435 if (dom_entry == NULL)
434 goto socket_setattr_return; 436 goto socket_setattr_return;
435 switch (dom_entry->type) { 437 switch (dom_entry->type) {
438 case NETLBL_NLTYPE_ADDRSELECT:
439 ret_val = -EDESTADDRREQ;
440 break;
436 case NETLBL_NLTYPE_CIPSOV4: 441 case NETLBL_NLTYPE_CIPSOV4:
437 ret_val = cipso_v4_sock_setattr(sk, 442 ret_val = cipso_v4_sock_setattr(sk,
438 dom_entry->type_def.cipsov4, 443 dom_entry->type_def.cipsov4,