X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=kernel%2Fnetwork.h;h=c3b032337a525d4c2531198ea606d9969bd3f723;hb=54edc50b584ade4f323c16bec6ef6320f129e531;hp=4841f9fa1d0d0e677b2db4177b3cf247853fec53;hpb=e6580882caefa10d48e7668d879b52d80b87a6b2;p=util-vserver.git diff --git a/kernel/network.h b/kernel/network.h index 4841f9f..c3b0323 100644 --- a/kernel/network.h +++ b/kernel/network.h @@ -6,137 +6,44 @@ #define MAX_N_CONTEXT 65535 /* Arbitrary limit */ -#define NX_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */ - #define NB_IPV4ROOT 16 /* network flags */ -#define NXF_INFO_LOCK 0x00000001 - -#define NXF_STATE_SETUP (1ULL<<32) -#define NXF_STATE_ADMIN (1ULL<<34) - -#define NXF_SC_HELPER (1ULL<<36) -#define NXF_PERSISTENT (1ULL<<38) - -#define NXF_ONE_TIME (0x0005ULL<<32) - -#define NXF_INIT_SET (NXF_STATE_ADMIN) - - -/* address types */ - -#define NXA_TYPE_IPV4 1 -#define NXA_TYPE_IPV6 2 - -#define NXA_MOD_BCAST (1<<8) - -#define NXA_TYPE_ANY ((uint16_t)-1) - - -#ifdef __KERNEL__ - -#include -#include -#include -#include +#define NXF_INFO_PRIVATE 0x00000008 +#define NXF_SINGLE_IP 0x00000100 -struct nx_info { - struct hlist_node nx_hlist; /* linked list of nxinfos */ - nid_t nx_id; /* vnet id */ - atomic_t nx_usecnt; /* usage count */ - atomic_t nx_tasks; /* tasks count */ - int nx_state; /* context state */ +#define NXF_HIDE_NETIF 0x02000000 - uint64_t nx_flags; /* network flag word */ - uint64_t nx_ncaps; /* network capabilities */ +#define NXF_STATE_SETUP (1ULL << 32) +#define NXF_STATE_ADMIN (1ULL << 34) - int nbipv4; - __u32 ipv4[NB_IPV4ROOT]; /* Process can only bind to these IPs */ - /* The first one is used to connect */ - /* and for bind any service */ - /* The other must be used explicity */ - __u32 mask[NB_IPV4ROOT]; /* Netmask for each ipv4 */ - /* Used to select the proper source */ - /* address for sockets */ - __u32 v4_bcast; /* Broadcast address to receive UDP */ +#define NXF_SC_HELPER (1ULL << 36) +#define NXF_PERSISTENT (1ULL << 38) - char nx_name[65]; /* network context name */ -}; +#define NXF_ONE_TIME (0x0005ULL << 32) +#define NXF_INIT_SET (NXF_STATE_ADMIN) -/* status flags */ - -#define NXS_HASHED 0x0001 -#define NXS_SHUTDOWN 0x0100 -#define NXS_RELEASED 0x8000 - -/* check conditions */ - -#define NX_ADMIN 0x0001 -#define NX_WATCH 0x0002 -#define NX_BLEND 0x0004 -#define NX_HOSTID 0x0008 - -#define NX_IDENT 0x0010 -#define NX_EQUIV 0x0020 -#define NX_PARENT 0x0040 -#define NX_CHILD 0x0080 - -#define NX_ARG_MASK 0x00F0 - -#define NX_DYNAMIC 0x0100 -#define NX_STATIC 0x0200 - -#define NX_ATR_MASK 0x0F00 - - -extern struct nx_info *lookup_nx_info(int); - -extern int get_nid_list(int, unsigned int *, int); -extern int nid_is_hashed(nid_t); - -extern int nx_migrate_task(struct task_struct *, struct nx_info *); - -extern long vs_net_change(struct nx_info *, unsigned int); -struct in_ifaddr; -struct net_device; +/* address types */ -#ifdef CONFIG_INET -int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *); -int dev_in_nx_info(struct net_device *, struct nx_info *); +#define NXA_TYPE_IPV4 0x0001 +#define NXA_TYPE_IPV6 0x0002 -#else /* CONFIG_INET */ -static inline -int ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n) -{ - return 1; -} +#define NXA_TYPE_NONE 0x0000 +#define NXA_TYPE_ANY 0x00FF -static inline -int dev_in_nx_info(struct net_device *d, struct nx_info *n) -{ - return 1; -} -#endif /* CONFIG_INET */ +#define NXA_TYPE_ADDR 0x0003 +#define NXA_TYPE_MASK 0x0013 +#define NXA_TYPE_RANGE 0x0023 -struct sock; +#define NXA_MOD_BCAST 0x0100 +#define NXA_MOD_LBACK 0x0200 -#ifdef CONFIG_INET -int nx_addr_conflict(struct nx_info *, uint32_t, struct sock *); -#else /* CONFIG_INET */ -static inline -int nx_addr_conflict(struct nx_info *n, uint32_t a, struct sock *s) -{ - return 1; -} -#endif /* CONFIG_INET */ -#endif /* __KERNEL__ */ #else /* _VX_NETWORK_H */ #warning duplicate inclusion #endif /* _VX_NETWORK_H */