netlabel_kapi.c (a04e71f631fa3d2fd2aa0404c11484739d1e9073) netlabel_kapi.c (4fee5242bf41d9ad641d4c1b821e36eb7ba37fbf)
1/*
2 * NetLabel Kernel API
3 *
4 * This file defines the kernel API for the NetLabel system. The NetLabel
5 * system manages static and dynamic label mappings for network protocols such
6 * as CIPSO and RIPSO.
7 *
8 * Author: Paul Moore <paul@paul-moore.com>

--- 1267 unchanged lines hidden (view full) ---

1276 * For all of the NetLabel protocols that support some form of label mapping
1277 * cache, invalidate the cache. Returns zero on success, negative values on
1278 * error.
1279 *
1280 */
1281void netlbl_cache_invalidate(void)
1282{
1283 cipso_v4_cache_invalidate();
1/*
2 * NetLabel Kernel API
3 *
4 * This file defines the kernel API for the NetLabel system. The NetLabel
5 * system manages static and dynamic label mappings for network protocols such
6 * as CIPSO and RIPSO.
7 *
8 * Author: Paul Moore <paul@paul-moore.com>

--- 1267 unchanged lines hidden (view full) ---

1276 * For all of the NetLabel protocols that support some form of label mapping
1277 * cache, invalidate the cache. Returns zero on success, negative values on
1278 * error.
1279 *
1280 */
1281void netlbl_cache_invalidate(void)
1282{
1283 cipso_v4_cache_invalidate();
1284#if IS_ENABLED(CONFIG_IPV6)
1285 calipso_cache_invalidate();
1286#endif /* IPv6 */
1284}
1285
1286/**
1287 * netlbl_cache_add - Add an entry to a NetLabel protocol cache
1288 * @skb: the packet
1287}
1288
1289/**
1290 * netlbl_cache_add - Add an entry to a NetLabel protocol cache
1291 * @skb: the packet
1292 * @family: the family
1289 * @secattr: the packet's security attributes
1290 *
1291 * Description:
1292 * Add the LSM security attributes for the given packet to the underlying
1293 * NetLabel protocol's label mapping cache. Returns zero on success, negative
1294 * values on error.
1295 *
1296 */
1293 * @secattr: the packet's security attributes
1294 *
1295 * Description:
1296 * Add the LSM security attributes for the given packet to the underlying
1297 * NetLabel protocol's label mapping cache. Returns zero on success, negative
1298 * values on error.
1299 *
1300 */
1297int netlbl_cache_add(const struct sk_buff *skb,
1301int netlbl_cache_add(const struct sk_buff *skb, u16 family,
1298 const struct netlbl_lsm_secattr *secattr)
1299{
1300 unsigned char *ptr;
1301
1302 if ((secattr->flags & NETLBL_SECATTR_CACHE) == 0)
1303 return -ENOMSG;
1304
1302 const struct netlbl_lsm_secattr *secattr)
1303{
1304 unsigned char *ptr;
1305
1306 if ((secattr->flags & NETLBL_SECATTR_CACHE) == 0)
1307 return -ENOMSG;
1308
1305 ptr = cipso_v4_optptr(skb);
1306 if (ptr)
1307 return cipso_v4_cache_add(ptr, secattr);
1308
1309 switch (family) {
1310 case AF_INET:
1311 ptr = cipso_v4_optptr(skb);
1312 if (ptr)
1313 return cipso_v4_cache_add(ptr, secattr);
1314 break;
1315#if IS_ENABLED(CONFIG_IPV6)
1316 case AF_INET6:
1317 ptr = calipso_optptr(skb);
1318 if (ptr)
1319 return calipso_cache_add(ptr, secattr);
1320 break;
1321#endif /* IPv6 */
1322 }
1309 return -ENOMSG;
1310}
1311
1312/*
1313 * Protocol Engine Functions
1314 */
1315
1316/**

--- 65 unchanged lines hidden ---
1323 return -ENOMSG;
1324}
1325
1326/*
1327 * Protocol Engine Functions
1328 */
1329
1330/**

--- 65 unchanged lines hidden ---