/* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Routing netlink socket interface: protocol independent part. * * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * Fixes: * Vitaly E. Lavrov RTA_OK arithmetics was wrong. */#include<linux/errno.h>#include<linux/module.h>#include<linux/types.h>#include<linux/socket.h>#include<linux/kernel.h>#include<linux/timer.h>#include<linux/string.h>#include<linux/sockios.h>#include<linux/net.h>#include<linux/fcntl.h>#include<linux/mm.h>#include<linux/slab.h>#include<linux/interrupt.h>#include<linux/capability.h>#include<linux/skbuff.h>#include<linux/init.h>#include<linux/security.h>#include<linux/mutex.h>#include<linux/if_addr.h>#include<linux/nsproxy.h>#include<asm/uaccess.h>#include<asm/system.h>#include<asm/string.h>#include<linux/inet.h>#include<linux/netdevice.h>#include<net/ip.h>#include<net/protocol.h>#include<net/arp.h>#include<net/route.h>#include<net/udp.h>#include<net/sock.h>#include<net/pkt_sched.h>#include<net/fib_rules.h>#include<net/rtnetlink.h>structrtnl_link{rtnl_doit_funcdoit;rtnl_dumpit_funcdumpit;};staticDEFINE_MUTEX(rtnl_mutex);voidrtnl_lock(void){mutex_lock(&rtnl_mutex);}void__rtnl_unlock(void){mutex_unlock(&rtnl_mutex);}voidrtnl_unlock(void){mutex_unlock(&rtnl_mutex);netdev_run_todo();}intrtnl_trylock(void){returnmutex_trylock(&rtnl_mutex);}staticstructrtnl_link*rtnl_msg_handlers[NPROTO];staticinlineintrtm_msgindex(intmsgtype){intmsgindex=msgtype-RTM_BASE;/* * msgindex < 0 implies someone tried to register a netlink * control code. msgindex >= RTM_NR_MSGTYPES may indicate that * the message type has not been added to linux/rtnetlink.h */BUG_ON(msgindex<0||