1173095Srwatson/*- 2189797Srwatson * Copyright (c) 2007-2009 Robert N. M. Watson 3173095Srwatson * All rights reserved. 4173095Srwatson * 5173095Srwatson * This software was developed by Robert Watson for the TrustedBSD Project. 6173095Srwatson * 7189797Srwatson * This software was developed at the University of Cambridge Computer 8189797Srwatson * Laboratory with support from a grant from Google, Inc. 9189797Srwatson * 10173095Srwatson * Redistribution and use in source and binary forms, with or without 11173095Srwatson * modification, are permitted provided that the following conditions 12173095Srwatson * are met: 13173095Srwatson * 1. Redistributions of source code must retain the above copyright 14173095Srwatson * notice, this list of conditions and the following disclaimer. 15173095Srwatson * 2. Redistributions in binary form must reproduce the above copyright 16173095Srwatson * notice, this list of conditions and the following disclaimer in the 17173095Srwatson * documentation and/or other materials provided with the distribution. 18173095Srwatson * 19173095Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20173095Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21173095Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22173095Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23173095Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24173095Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25173095Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26173095Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27173095Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28173095Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29173095Srwatson * SUCH DAMAGE. 30173095Srwatson */ 31173095Srwatson 32173095Srwatson#include <sys/cdefs.h> 33173095Srwatson__FBSDID("$FreeBSD$"); 34173095Srwatson 35173095Srwatson#include "opt_mac.h" 36173095Srwatson 37173095Srwatson#include <sys/param.h> 38173095Srwatson#include <sys/kernel.h> 39173095Srwatson#include <sys/lock.h> 40173095Srwatson#include <sys/malloc.h> 41173095Srwatson#include <sys/mutex.h> 42173095Srwatson#include <sys/sbuf.h> 43173095Srwatson#include <sys/systm.h> 44173095Srwatson#include <sys/mount.h> 45173095Srwatson#include <sys/file.h> 46173095Srwatson#include <sys/namei.h> 47173095Srwatson#include <sys/protosw.h> 48173095Srwatson#include <sys/socket.h> 49173095Srwatson#include <sys/socketvar.h> 50173095Srwatson#include <sys/sysctl.h> 51173095Srwatson 52173095Srwatson#include <net/if.h> 53173095Srwatson#include <net/if_var.h> 54173095Srwatson 55173095Srwatson#include <security/mac/mac_framework.h> 56173095Srwatson#include <security/mac/mac_internal.h> 57173095Srwatson#include <security/mac/mac_policy.h> 58173095Srwatson 59173095Srwatsonvoid 60173095Srwatsonmac_netatalk_aarp_send(struct ifnet *ifp, struct mbuf *m) 61173095Srwatson{ 62173095Srwatson struct label *mlabel; 63173095Srwatson 64193391Srwatson if (mac_policy_count == 0) 65193391Srwatson return; 66193391Srwatson 67173095Srwatson mlabel = mac_mbuf_to_label(m); 68173095Srwatson 69173095Srwatson MAC_IFNET_LOCK(ifp); 70191731Srwatson MAC_POLICY_PERFORM_NOSLEEP(netatalk_aarp_send, ifp, ifp->if_label, m, 71189797Srwatson mlabel); 72173095Srwatson MAC_IFNET_UNLOCK(ifp); 73173095Srwatson} 74