#ifndef __LXC_NETWORK_H
#define __LXC_NETWORK_H
+#include <arpa/inet.h>
+#include <linux/types.h>
#include <stdbool.h>
#include <stdio.h>
-#include <unistd.h>
-#include <arpa/inet.h>
#include <sys/socket.h>
+#include <unistd.h>
#include "list.h"
LXC_NET_EMPTY,
LXC_NET_VETH,
LXC_NET_MACVLAN,
+ LXC_NET_IPVLAN,
LXC_NET_PHYS,
LXC_NET_VLAN,
LXC_NET_NONE,
char pair[IFNAMSIZ];
char veth1[IFNAMSIZ];
int ifindex;
+ struct lxc_list ipv4_routes;
+ struct lxc_list ipv6_routes;
};
struct ifla_vlan {
int mode; /* private, vepa, bridge, passthru */
};
+struct ifla_ipvlan {
+ int mode; /* l3, l3s, l2 */
+ int isolation; /* bridge, private, vepa */
+};
+
/* Contains information about the physical network device as seen from the host.
* @ifindex : The ifindex of the physical network device in the host's network
* namespace.
*/
struct ifla_phys {
int ifindex;
+ int mtu;
};
union netdev_p {
struct ifla_macvlan macvlan_attr;
+ struct ifla_ipvlan ipvlan_attr;
struct ifla_phys phys_attr;
struct ifla_veth veth_attr;
struct ifla_vlan vlan_attr;
* @flags : flag of the network device (IFF_UP, ... )
* @link : lxc.net.[i].link, name of bridge or host iface to attach
* if any
- * @name : lxc.net.[i].name, name of iface on the container side
+ * @name : lxc.net.[i].name, name of iface on the container side
+ * @created_name : the name with which this interface got created before
+ * being renamed to final_name.
+ * Currenly only used for veth devices.
* @hwaddr : mac address
* @mtu : maximum transmission unit
* @priv : information specific to the specificed network type
* @ipv6 : a list of ipv6 addresses to be set on the network device
* @ipv4_gateway_auto : whether the ipv4 gateway is to be automatically gathered
* from the associated @link
+ * @ipv4_gateway_dev : whether the ipv4 gateway is to be set as a device route
* @ipv4_gateway : ipv4 gateway
* @ipv6_gateway_auto : whether the ipv6 gateway is to be automatically gathered
* from the associated @link
+ * @ipv6_gateway_dev : whether the ipv6 gateway is to be set as a device route
* @ipv6_gateway : ipv6 gateway
* @upscript : a script filename to be executed during interface
* configuration
int type;
int flags;
char link[IFNAMSIZ];
+ bool l2proxy;
char name[IFNAMSIZ];
+ char created_name[IFNAMSIZ];
char *hwaddr;
char *mtu;
union netdev_p priv;
struct lxc_list ipv4;
struct lxc_list ipv6;
bool ipv4_gateway_auto;
+ bool ipv4_gateway_dev;
struct in_addr *ipv4_gateway;
bool ipv6_gateway_auto;
+ bool ipv6_gateway_dev;
struct in6_addr *ipv6_gateway;
char *upscript;
char *downscript;
extern int lxc_ipv4_addr_get(int ifindex, struct in_addr **res);
extern int lxc_ipv6_addr_get(int ifindex, struct in6_addr **res);
-/* Set a destination route to an interface. */
-extern int lxc_ipv4_dest_add(int ifindex, struct in_addr *dest);
-extern int lxc_ipv6_dest_add(int ifindex, struct in6_addr *dest);
-
/* Set default route. */
extern int lxc_ipv4_gateway_add(int ifindex, struct in_addr *gw);
extern int lxc_ipv6_gateway_add(int ifindex, struct in6_addr *gw);
extern const char *lxc_net_type_to_str(int type);
extern int setup_private_host_hw_addr(char *veth1);
extern int netdev_get_mtu(int ifindex);
-extern int lxc_create_network_priv(struct lxc_handler *handler);
-extern int lxc_network_move_created_netdev_priv(const char *lxcpath,
- const char *lxcname,
- struct lxc_list *network,
- pid_t pid);
+extern int lxc_network_move_created_netdev_priv(struct lxc_handler *handler);
extern void lxc_delete_network(struct lxc_handler *handler);
extern int lxc_find_gateway_addresses(struct lxc_handler *handler);
-extern int lxc_create_network_unpriv(const char *lxcpath, const char *lxcname,
- struct lxc_list *network, pid_t pid, unsigned int hook_version);
extern int lxc_requests_empty_network(struct lxc_handler *handler);
extern int lxc_restore_phys_nics_to_netns(struct lxc_handler *handler);
extern int lxc_setup_network_in_child_namespaces(const struct lxc_conf *conf,
struct lxc_list *network);
-extern int lxc_network_send_veth_names_to_child(struct lxc_handler *handler);
-extern int lxc_network_recv_veth_names_from_parent(struct lxc_handler *handler);
+extern int lxc_network_send_to_child(struct lxc_handler *handler);
+extern int lxc_network_recv_from_parent(struct lxc_handler *handler);
extern int lxc_network_send_name_and_ifindex_to_parent(struct lxc_handler *handler);
extern int lxc_network_recv_name_and_ifindex_from_child(struct lxc_handler *handler);
+extern int lxc_netns_set_nsid(int netns_fd);
+extern int lxc_netns_get_nsid(__s32 fd);
+extern int lxc_create_network(struct lxc_handler *handler);
#endif /* __LXC_NETWORK_H */