{
struct netdev_dev_pltap *dev =
netdev_dev_pltap_cast(netdev_get_dev(netdev_));
- char prefix[4];
+ struct tun_pi pi;
struct iovec iov[2] = {
- { .iov_base = prefix, .iov_len = 4 },
+ { .iov_base = &pi, .iov_len = sizeof(pi) },
{ .iov_base = buffer, .iov_len = size }
};
if (!dev->finalized)
{
struct netdev_dev_pltap *dev =
netdev_dev_pltap_cast(netdev_get_dev(netdev_));
- char prefix[4] = { 0, 0, 8, 6 };
+ struct tun_pi pi = { 0, htons(ETH_P_IP) };
struct iovec iov[2] = {
- { .iov_base = prefix, .iov_len = 4 },
+ { .iov_base = &pi, .iov_len = sizeof(pi) },
{ .iov_base = buffer, .iov_len = size }
};
if (dev->fd < 0 || !dev->finalized)
ssize_t retval;
retval = writev(dev->fd, iov, 2);
if (retval >= 0) {
- if (retval != size + 4) {
+ if (retval != size + sizeof(pi)) {
VLOG_WARN_RL(&rl, "sent partial Ethernet packet (%zd bytes of %zu) on %s",
- retval, size + 4, netdev_get_name(netdev_));
+ retval, size + sizeof(pi), netdev_get_name(netdev_));
}
return 0;
} else if (errno != EINTR) {
controllers: $(CONTROLLERS)
.PHONY: controllers
+del-controllers: $(foreach id,$(ALL_NODE_IDS),del-controller-$(id))
+.PHONY: del-controllers
+
### node-oriented targets
# check ssh connectivity
sshcheck-%: FORCE
@$(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop-db
@rm -f cache/db.$*
+del-controller.%:
+ @echo "Removing controller for $(call display,$*)"
+ @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs del-controller $(BRIDGE)
+ @rm -f cache/controller.$*
+
del-links: $(addprefix U/,$(notdir $(filter-out %.log,$(wildcard L/*))))
del-switchs: $(addprefix del-,$(notdir $(filter-out %.log,$(wildcard cache/switch.*))))
ovs-vsctl --db=unix:$DB_SOCKET set-controller "$bridge_name" "$controller"
}
+function del_controller () {
+
+ get_params "bridge_name" "$@"
+
+ # ensure ovs-vswitchd is running
+ is_switch_running || { echo "ovs-vswitchd not running" >&2 ; exit 1 ; }
+
+ set -e
+ ovs-vsctl --db=unix:$DB_SOCKET del-controller "$bridge_name"
+}
+
#################### del functions
function del_bridge () {
SUPPORTED_SUBCOMMANDS="start stop status
start_db stop_db start_switch stop_switch
create_bridge create_port del_bridge del_port
-show set_remote_endpoint"
+show set_remote_endpoint set_controller del_controller"
function main () {
message="Usage: $COMMAND <subcommand> ...