vlan: rework VLAN interface creation/deletion

First make it build on libnl1/2.  Second, the VLAN
virtual interface name might not always be given in the
NMConnection (if the master is a UUID and thus the name
is determined automatically) so just take the interface
name instead.  And make sure we verify it's a VLAN
interface before deleting it.

Lastly, construct the VLAN interface name if it's not
given in the NMConnection.  This means we need to know
the master interface name when creating the connection,
which we always will since you can't create the VLAN
interface without it's master being present.  That also
means we need to return the name to the caller so it
can be used to create the NMDevice for the VLAN interface
after we've created it in the kernel.
This commit is contained in:
Dan Williams
2011-12-21 19:09:22 -06:00
parent ab43b7b41d
commit 0c3efb1787
3 changed files with 125 additions and 100 deletions

View File

@@ -243,6 +243,55 @@ rtnl_link_bond_release_ifindex (struct nl_sock *h, int slave_ifidx)
/* Bonding only in libnl3 */
return -NLE_OPNOTSUPP;
}
static inline int
rtnl_link_vlan_set_id (struct rtnl_link *l, int id)
{
/* VLAN only in libnl3 */
return -NLE_OPNOTSUPP;
}
static inline int
rtnl_link_vlan_set_flags (struct rtnl_link *l, unsigned int flags)
{
/* VLAN only in libnl3 */
return -NLE_OPNOTSUPP;
}
static inline int
rtnl_link_vlan_set_ingress_map (struct rtnl_link *l, int from, uint32_t to)
{
/* VLAN only in libnl3 */
return -NLE_OPNOTSUPP;
}
static inline int
rtnl_link_vlan_set_egress_map (struct rtnl_link *l, int from, uint32_t to)
{
/* VLAN only in libnl3 */
return -NLE_OPNOTSUPP;
}
static inline int
rtnl_link_set_type (struct rtnl_link *l, const char *type)
{
/* Operation only in libnl3 */
return -NLE_OPNOTSUPP;
}
static inline int
rtnl_link_add (struct nl_sock *sk, struct rtnl_link *l, int flags)
{
/* Operation only in libnl3 */
return -NLE_OPNOTSUPP;
}
static inline int
rtnl_link_delete(struct nl_sock *sk, const struct rtnl_link *l)
{
/* Operation only in libnl3 */
return -NLE_OPNOTSUPP;
}
#endif /* HAVE_LIBNL1 || HAVE_LIBNL2 */
#endif /* NM_NETLINK_COMPAT_H */