/*1* INET An implementation of the TCP/IP protocol suite for the LINUX2* operating system. INET is implemented using the BSD Socket3* interface as the means of communication with the user level.4*5* PF_INET6 protocol dispatch tables.6*7* Authors: Pedro Roque <[email protected]>8*9* This program is free software; you can redistribute it and/or10* modify it under the terms of the GNU General Public License11* as published by the Free Software Foundation; either version12* 2 of the License, or (at your option) any later version.13*/1415/*16* Changes:17*18* Vince Laviano ([email protected]) 16 May 200119* - Removed unused variable 'inet6_protocol_base'20* - Modified inet6_del_protocol() to correctly maintain copy bit.21*/22#include <linux/module.h>23#include <linux/netdevice.h>24#include <linux/spinlock.h>25#include <net/protocol.h>2627const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS] __read_mostly;2829int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char protocol)30{31int hash = protocol & (MAX_INET_PROTOS - 1);3233return !cmpxchg((const struct inet6_protocol **)&inet6_protos[hash],34NULL, prot) ? 0 : -1;35}36EXPORT_SYMBOL(inet6_add_protocol);3738/*39* Remove a protocol from the hash tables.40*/4142int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char protocol)43{44int ret, hash = protocol & (MAX_INET_PROTOS - 1);4546ret = (cmpxchg((const struct inet6_protocol **)&inet6_protos[hash],47prot, NULL) == prot) ? 0 : -1;4849synchronize_net();5051return ret;52}53EXPORT_SYMBOL(inet6_del_protocol);545556