4 #include <linux/types.h>
7 #define MAX_N_CONTEXT 65535 /* Arbitrary limit */
9 #define NX_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */
11 #define NB_IPV4ROOT 16
16 #define NXF_INFO_LOCK 0x00000001
18 #define NXF_STATE_SETUP (1ULL<<32)
19 #define NXF_STATE_ADMIN (1ULL<<34)
21 #define NXF_SC_HELPER (1ULL<<36)
22 #define NXF_PERSISTENT (1ULL<<38)
24 #define NXF_ONE_TIME (0x0005ULL<<32)
26 #define NXF_INIT_SET (NXF_STATE_ADMIN)
31 #define NXA_TYPE_IPV4 1
32 #define NXA_TYPE_IPV6 2
34 #define NXA_MOD_BCAST (1<<8)
36 #define NXA_TYPE_ANY ((uint16_t)-1)
41 #include <linux/list.h>
42 #include <linux/spinlock.h>
43 #include <linux/rcupdate.h>
44 #include <asm/atomic.h>
48 struct hlist_node nx_hlist; /* linked list of nxinfos */
49 nid_t nx_id; /* vnet id */
50 atomic_t nx_usecnt; /* usage count */
51 atomic_t nx_tasks; /* tasks count */
52 int nx_state; /* context state */
54 uint64_t nx_flags; /* network flag word */
55 uint64_t nx_ncaps; /* network capabilities */
58 __u32 ipv4[NB_IPV4ROOT]; /* Process can only bind to these IPs */
59 /* The first one is used to connect */
60 /* and for bind any service */
61 /* The other must be used explicity */
62 __u32 mask[NB_IPV4ROOT]; /* Netmask for each ipv4 */
63 /* Used to select the proper source */
64 /* address for sockets */
65 __u32 v4_bcast; /* Broadcast address to receive UDP */
67 char nx_name[65]; /* network context name */
73 #define NXS_HASHED 0x0001
74 #define NXS_SHUTDOWN 0x0100
75 #define NXS_RELEASED 0x8000
77 /* check conditions */
79 #define NX_ADMIN 0x0001
80 #define NX_WATCH 0x0002
81 #define NX_BLEND 0x0004
82 #define NX_HOSTID 0x0008
84 #define NX_IDENT 0x0010
85 #define NX_EQUIV 0x0020
86 #define NX_PARENT 0x0040
87 #define NX_CHILD 0x0080
89 #define NX_ARG_MASK 0x00F0
91 #define NX_DYNAMIC 0x0100
92 #define NX_STATIC 0x0200
94 #define NX_ATR_MASK 0x0F00
97 extern struct nx_info *lookup_nx_info(int);
99 extern int get_nid_list(int, unsigned int *, int);
100 extern int nid_is_hashed(nid_t);
102 extern int nx_migrate_task(struct task_struct *, struct nx_info *);
104 extern long vs_net_change(struct nx_info *, unsigned int);
110 int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *);
111 int dev_in_nx_info(struct net_device *, struct nx_info *);
113 #else /* CONFIG_INET */
115 int ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
121 int dev_in_nx_info(struct net_device *d, struct nx_info *n)
125 #endif /* CONFIG_INET */
130 int nx_addr_conflict(struct nx_info *, uint32_t, struct sock *);
131 #else /* CONFIG_INET */
133 int nx_addr_conflict(struct nx_info *n, uint32_t a, struct sock *s)
137 #endif /* CONFIG_INET */
139 #endif /* __KERNEL__ */
140 #else /* _VX_NETWORK_H */
141 #warning duplicate inclusion
142 #endif /* _VX_NETWORK_H */