18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * CALIPSO - Common Architecture Label IPv6 Security Option 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * This is an implementation of the CALIPSO protocol as specified in 68c2ecf20Sopenharmony_ci * RFC 5570. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Authors: Paul Moore <paul@paul-moore.com> 98c2ecf20Sopenharmony_ci * Huw Davies <huw@codeweavers.com> 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/* 138c2ecf20Sopenharmony_ci * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 148c2ecf20Sopenharmony_ci * (c) Copyright Huw Davies <huw@codeweavers.com>, 2015 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#ifndef _CALIPSO_H 188c2ecf20Sopenharmony_ci#define _CALIPSO_H 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include <linux/types.h> 218c2ecf20Sopenharmony_ci#include <linux/rcupdate.h> 228c2ecf20Sopenharmony_ci#include <linux/list.h> 238c2ecf20Sopenharmony_ci#include <linux/net.h> 248c2ecf20Sopenharmony_ci#include <linux/skbuff.h> 258c2ecf20Sopenharmony_ci#include <net/netlabel.h> 268c2ecf20Sopenharmony_ci#include <net/request_sock.h> 278c2ecf20Sopenharmony_ci#include <linux/refcount.h> 288c2ecf20Sopenharmony_ci#include <asm/unaligned.h> 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* known doi values */ 318c2ecf20Sopenharmony_ci#define CALIPSO_DOI_UNKNOWN 0x00000000 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* doi mapping types */ 348c2ecf20Sopenharmony_ci#define CALIPSO_MAP_UNKNOWN 0 358c2ecf20Sopenharmony_ci#define CALIPSO_MAP_PASS 2 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* 388c2ecf20Sopenharmony_ci * CALIPSO DOI definitions 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* DOI definition struct */ 428c2ecf20Sopenharmony_cistruct calipso_doi { 438c2ecf20Sopenharmony_ci u32 doi; 448c2ecf20Sopenharmony_ci u32 type; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci refcount_t refcount; 478c2ecf20Sopenharmony_ci struct list_head list; 488c2ecf20Sopenharmony_ci struct rcu_head rcu; 498c2ecf20Sopenharmony_ci}; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* 528c2ecf20Sopenharmony_ci * Sysctl Variables 538c2ecf20Sopenharmony_ci */ 548c2ecf20Sopenharmony_ciextern int calipso_cache_enabled; 558c2ecf20Sopenharmony_ciextern int calipso_cache_bucketsize; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#ifdef CONFIG_NETLABEL 588c2ecf20Sopenharmony_ciint __init calipso_init(void); 598c2ecf20Sopenharmony_civoid calipso_exit(void); 608c2ecf20Sopenharmony_cibool calipso_validate(const struct sk_buff *skb, const unsigned char *option); 618c2ecf20Sopenharmony_ci#else 628c2ecf20Sopenharmony_cistatic inline int __init calipso_init(void) 638c2ecf20Sopenharmony_ci{ 648c2ecf20Sopenharmony_ci return 0; 658c2ecf20Sopenharmony_ci} 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_cistatic inline void calipso_exit(void) 688c2ecf20Sopenharmony_ci{ 698c2ecf20Sopenharmony_ci} 708c2ecf20Sopenharmony_cistatic inline bool calipso_validate(const struct sk_buff *skb, 718c2ecf20Sopenharmony_ci const unsigned char *option) 728c2ecf20Sopenharmony_ci{ 738c2ecf20Sopenharmony_ci return true; 748c2ecf20Sopenharmony_ci} 758c2ecf20Sopenharmony_ci#endif /* CONFIG_NETLABEL */ 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#endif /* _CALIPSO_H */ 78