return 0;
/* The interface will have been automatically added to vlan 1, so remove it. */
- if (virNetlinkBridgeVlanFilterSet(ifname, RTM_DELLINK, 0, 1, &error) < 0) {
+ if (virNetlinkBridgeVlanFilterDel(ifname, 1, &error) < 0) {
if (error != 0) {
virReportSystemError(-error,
_("error removing vlan filter from interface %1$s"),
flags |= BRIDGE_VLAN_INFO_UNTAGGED;
}
- if (virNetlinkBridgeVlanFilterSet(ifname, RTM_SETLINK, flags,
+ if (virNetlinkBridgeVlanFilterSet(ifname, flags,
virtVlan->nativeTag, &error) < 0) {
goto error;
}
for (i = 0; i < virtVlan->nTags; i++) {
if (virtVlan->tag[i] != virtVlan->nativeTag)
- if (virNetlinkBridgeVlanFilterSet(ifname, RTM_SETLINK, 0,
+ if (virNetlinkBridgeVlanFilterSet(ifname, 0,
virtVlan->tag[i], &error) < 0) {
goto error;
}
} else {
/* In native mode, add the single VLAN as pvid untagged. */
flags = BRIDGE_VLAN_INFO_PVID | BRIDGE_VLAN_INFO_UNTAGGED;
- if (virNetlinkBridgeVlanFilterSet(ifname, RTM_SETLINK, flags,
+ if (virNetlinkBridgeVlanFilterSet(ifname, flags,
virtVlan->tag[0], &error) < 0) {
goto error;
}
}
/**
- * virNetlinkBridgeVlanFilterSet:
+ * virNetlinkBridgeVlanFilterHelper:
*
* @ifname: name of the link
* @cmd: netlink command, either RTM_SETLINK or RTM_DELLINK
* non-zero, then a netlink failure occurred, but no error message
* is generated leaving it up to the caller to handle the condition.
*/
-int
-virNetlinkBridgeVlanFilterSet(const char *ifname,
- int cmd,
- const unsigned short flags,
- const short vid,
- int *error)
+static int
+virNetlinkBridgeVlanFilterHelper(const char *ifname,
+ int cmd,
+ const unsigned short flags,
+ const short vid,
+ int *error)
{
struct ifinfomsg ifm = { .ifi_family = PF_BRIDGE };
struct bridge_vlan_info vinfo = { .flags = flags, .vid = vid };
return 0;
}
+
+/**
+ * virNetlinkBridgeVlanFilterSet:
+ *
+ * @ifname: name of the link
+ * @flags: flags to use when adding the vlan filter
+ * @vid: vlan id to add
+ * @error: netlink error code
+ *
+ * Add a vlan filter from an interface associated with a bridge.
+ *
+ * Returns 0 on success, -1 on error. Additionally, if the @error is
+ * non-zero, then a netlink failure occurred, but no error message
+ * is generated leaving it up to the caller to handle the condition.
+ */
+int
+virNetlinkBridgeVlanFilterSet(const char *ifname,
+ const unsigned short flags,
+ const short vid,
+ int *error)
+{
+ return virNetlinkBridgeVlanFilterHelper(ifname, RTM_SETLINK,
+ flags, vid, error);
+}
+
+
+/**
+ * virNetlinkBridgeVlanFilterDel:
+ *
+ * @ifname: name of the link
+ * @vid: vlan id to remove
+ * @error: netlink error code
+ *
+ * Remove a vlan filter from an interface associated with a bridge.
+ *
+ * Returns 0 on success, -1 on error. Additionally, if the @error is
+ * non-zero, then a netlink failure occurred, but no error message
+ * is generated leaving it up to the caller to handle the condition.
+ */
+int
+virNetlinkBridgeVlanFilterDel(const char *ifname,
+ const short vid,
+ int *error)
+{
+ return virNetlinkBridgeVlanFilterHelper(ifname,
+ RTM_DELLINK, 0, vid, error);
+}
+
+
/**
* virNetlinkGetNeighbor:
*
int
virNetlinkBridgeVlanFilterSet(const char *ifname G_GNUC_UNUSED,
- int cmd G_GNUC_UNUSED,
const unsigned short unusedflags G_GNUC_UNUSED,
const short vid G_GNUC_UNUSED,
int *error)
return -1;
}
+int
+virNetlinkBridgeVlanFilterDel(const char *ifname G_GNUC_UNUSED,
+ const short vid G_GNUC_UNUSED,
+ int *error G_GNUC_UNUSED)
+{
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ return -1;
+}
+
int
virNetlinkGetNeighbor(void **nlData G_GNUC_UNUSED,
uint32_t src_pid G_GNUC_UNUSED,