23
24
#define IFNAMSIZE 16
26
#define MAC_SIZE 3*ETH_ALEN - 1
27
#define VZNETCFG SBINDIR "/vznetcfg"
29
#define PROC_VETH "/proc/vz/veth"
31
#define SW_OUI 0x001851
32
#define DEF_VETHNAME "veth$VEID"
26
35
/** Data structure for devices.
29
list_elem_t list; /**< next element. */
38
list_elem_t list; /**< prev/next element. */
30
39
char dev_addr[ETH_ALEN]; /**< device MAC address. */
31
40
int addrlen; /**< device MAC address length. */
32
41
char dev_name[IFNAMSIZE]; /**< device name. */
33
char dev_addr_ve[ETH_ALEN]; /**< device MAC address in VPS. */
34
int addrlen_ve; /**< VPS device MAC address length. */
35
char dev_name_ve[IFNAMSIZE]; /**< device name in VPS. */
42
char dev_addr_ve[ETH_ALEN]; /**< device MAC address in VE. */
43
int addrlen_ve; /**< VE device MAC address length. */
44
char dev_name_ve[IFNAMSIZE]; /**< device name in VE. */
45
/** Create/remove veth devices for VPS.
58
/** Create/remove veth devices for VE.
47
* @param h VPS handler.
60
* @param h VE handler.
49
62
* @return 0 on success.
52
int vps_setup_veth(vps_handler *h, envid_t veid, struct vps_param *param);
65
int vps_setup_veth(vps_handler *h, envid_t veid, dist_actions *actions,
66
char *root, veth_param *veth_add, veth_param *veth_del, int state,
53
68
int add_veth_param(veth_param *list, veth_dev *dev);
69
void free_veth(list_head_t *head);
54
70
void free_veth_param(veth_param *dev);
55
71
int copy_veth_param(veth_param *dst, veth_param *src);
56
72
int merge_veth_list(list_head_t *old, list_head_t *add, list_head_t *del,
57
73
veth_param *merged);
74
void generate_mac(int veid, char *dev_name, char *mac);
75
void free_veth_dev(veth_dev *dev);
76
veth_dev *find_veth_by_ifname_ve(list_head_t *head, char *name);
77
veth_dev *find_veth_configure(list_head_t *head);
78
int merge_veth_list(list_head_t *old, list_head_t *add, list_head_t *del,
80
int parse_hwaddr(const char *str, char *addr);
81
int check_veth_param(envid_t veid, veth_param *veth_old, veth_param *veth_new,
82
veth_param *veth_del);
58
84
#endif /* _VETH_H_ */