X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fin-band.c;h=857618fd0832b24bae0112711e2b77fdf11ff5cf;hb=3c5f6de3856fa47aa184ca389dcb8d4fcc13d29a;hp=4a2ea834af0c36cc7da6d5861be35e2e4197cf54;hpb=ec6fde61c85ff6a57b05d422a9d8b5ef679ad928;p=openvswitch diff --git a/ofproto/in-band.c b/ofproto/in-band.c index 4a2ea834..857618fd 100644 --- a/ofproto/in-band.c +++ b/ofproto/in-band.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ * * In Open vSwitch, in-band control is implemented as "hidden" flows (in * that they are not visible through OpenFlow) and at a higher priority - * than wildcarded flows can be setup by the controller. This is done + * than wildcarded flows can be set up by the controller. This is done * so that the controller cannot interfere with them and possibly break * connectivity with its switches. It is possible to see all flows, * including in-band ones, with the ovs-appctl "bridge/dump-flows" @@ -182,7 +182,7 @@ * * - Differing Controllers for Switches. All switches must know * the L3 addresses for all the controllers that other switches - * may use, since rules need to be setup to allow traffic related + * may use, since rules need to be set up to allow traffic related * to those controllers through. See rules (f), (g), (h), and (i). * * - Differing Routes for Switches. In order for the switch to @@ -272,8 +272,8 @@ get_remote_mac(struct in_band *ib) || strcmp(netdev_get_name(ib->remote_netdev), next_hop_dev)) { netdev_close(ib->remote_netdev); - retval = netdev_open(next_hop_dev, NETDEV_ETH_TYPE_NONE, - &ib->remote_netdev); + + retval = netdev_open_default(next_hop_dev, &ib->remote_netdev); if (retval) { VLOG_WARN_RL(&rl, "cannot open netdev %s (next hop " "to controller "IP_FMT"): %s", @@ -358,8 +358,8 @@ drop_flow(struct in_band *in_band, int rule_idx) /* out_port and fixed_fields are assumed never to change. */ static void -setup_flow(struct in_band *in_band, int rule_idx, const flow_t *flow, - uint32_t fixed_fields, uint16_t out_port) +set_up_flow(struct in_band *in_band, int rule_idx, const flow_t *flow, + uint32_t fixed_fields, uint16_t out_port) { struct ib_rule *rule = &in_band->rules[rule_idx]; @@ -481,28 +481,28 @@ in_band_run(struct in_band *in_band) flow.nw_proto = IP_TYPE_UDP; flow.tp_src = htons(DHCP_CLIENT_PORT); flow.tp_dst = htons(DHCP_SERVER_PORT); - setup_flow(in_band, IBR_FROM_LOCAL_DHCP, &flow, - (OFPFW_IN_PORT | OFPFW_DL_TYPE | OFPFW_DL_SRC - | OFPFW_NW_PROTO | OFPFW_TP_SRC | OFPFW_TP_DST), - OFPP_NORMAL); + set_up_flow(in_band, IBR_FROM_LOCAL_DHCP, &flow, + (OFPFW_IN_PORT | OFPFW_DL_TYPE | OFPFW_DL_SRC + | OFPFW_NW_PROTO | OFPFW_TP_SRC | OFPFW_TP_DST), + OFPP_NORMAL); /* Allow the connection's interface to receive directed ARP traffic. */ memset(&flow, 0, sizeof flow); flow.dl_type = htons(ETH_TYPE_ARP); memcpy(flow.dl_dst, local_mac, ETH_ADDR_LEN); flow.nw_proto = ARP_OP_REPLY; - setup_flow(in_band, IBR_TO_LOCAL_ARP, &flow, - (OFPFW_DL_TYPE | OFPFW_DL_DST | OFPFW_NW_PROTO), - OFPP_NORMAL); + set_up_flow(in_band, IBR_TO_LOCAL_ARP, &flow, + (OFPFW_DL_TYPE | OFPFW_DL_DST | OFPFW_NW_PROTO), + OFPP_NORMAL); /* Allow the connection's interface to be the source of ARP traffic. */ memset(&flow, 0, sizeof flow); flow.dl_type = htons(ETH_TYPE_ARP); memcpy(flow.dl_src, local_mac, ETH_ADDR_LEN); flow.nw_proto = ARP_OP_REQUEST; - setup_flow(in_band, IBR_FROM_LOCAL_ARP, &flow, - (OFPFW_DL_TYPE | OFPFW_DL_SRC | OFPFW_NW_PROTO), - OFPP_NORMAL); + set_up_flow(in_band, IBR_FROM_LOCAL_ARP, &flow, + (OFPFW_DL_TYPE | OFPFW_DL_SRC | OFPFW_NW_PROTO), + OFPP_NORMAL); } else { drop_flow(in_band, IBR_TO_LOCAL_ARP); drop_flow(in_band, IBR_FROM_LOCAL_ARP); @@ -514,18 +514,18 @@ in_band_run(struct in_band *in_band) flow.dl_type = htons(ETH_TYPE_ARP); memcpy(flow.dl_dst, remote_mac, ETH_ADDR_LEN); flow.nw_proto = ARP_OP_REPLY; - setup_flow(in_band, IBR_TO_REMOTE_ARP, &flow, - (OFPFW_DL_TYPE | OFPFW_DL_DST | OFPFW_NW_PROTO), - OFPP_NORMAL); + set_up_flow(in_band, IBR_TO_REMOTE_ARP, &flow, + (OFPFW_DL_TYPE | OFPFW_DL_DST | OFPFW_NW_PROTO), + OFPP_NORMAL); /* Allow ARP requests from the remote side's MAC. */ memset(&flow, 0, sizeof flow); flow.dl_type = htons(ETH_TYPE_ARP); memcpy(flow.dl_src, remote_mac, ETH_ADDR_LEN); flow.nw_proto = ARP_OP_REQUEST; - setup_flow(in_band, IBR_FROM_REMOTE_ARP, &flow, - (OFPFW_DL_TYPE | OFPFW_DL_SRC | OFPFW_NW_PROTO), - OFPP_NORMAL); + set_up_flow(in_band, IBR_FROM_REMOTE_ARP, &flow, + (OFPFW_DL_TYPE | OFPFW_DL_SRC | OFPFW_NW_PROTO), + OFPP_NORMAL); } else { drop_flow(in_band, IBR_TO_REMOTE_ARP); drop_flow(in_band, IBR_FROM_REMOTE_ARP); @@ -537,18 +537,18 @@ in_band_run(struct in_band *in_band) flow.dl_type = htons(ETH_TYPE_ARP); flow.nw_proto = ARP_OP_REPLY; flow.nw_dst = controller_ip; - setup_flow(in_band, IBR_TO_CTL_ARP, &flow, - (OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_DST_MASK), - OFPP_NORMAL); + set_up_flow(in_band, IBR_TO_CTL_ARP, &flow, + (OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_DST_MASK), + OFPP_NORMAL); /* Allow ARP requests from the controller's IP. */ memset(&flow, 0, sizeof flow); flow.dl_type = htons(ETH_TYPE_ARP); flow.nw_proto = ARP_OP_REQUEST; flow.nw_src = controller_ip; - setup_flow(in_band, IBR_FROM_CTL_ARP, &flow, - (OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_SRC_MASK), - OFPP_NORMAL); + set_up_flow(in_band, IBR_FROM_CTL_ARP, &flow, + (OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_SRC_MASK), + OFPP_NORMAL); /* OpenFlow traffic to or from the controller. * @@ -562,12 +562,12 @@ in_band_run(struct in_band *in_band) flow.nw_dst = controller_ip; flow.tp_src = htons(OFP_TCP_PORT); flow.tp_dst = htons(OFP_TCP_PORT); - setup_flow(in_band, IBR_TO_CTL_OFP, &flow, - (OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_DST_MASK - | OFPFW_TP_DST), OFPP_NORMAL); - setup_flow(in_band, IBR_FROM_CTL_OFP, &flow, - (OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_SRC_MASK - | OFPFW_TP_SRC), OFPP_NORMAL); + set_up_flow(in_band, IBR_TO_CTL_OFP, &flow, + (OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_DST_MASK + | OFPFW_TP_DST), OFPP_NORMAL); + set_up_flow(in_band, IBR_FROM_CTL_OFP, &flow, + (OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_SRC_MASK + | OFPFW_TP_SRC), OFPP_NORMAL); } else { drop_flow(in_band, IBR_TO_CTL_ARP); drop_flow(in_band, IBR_FROM_CTL_ARP); @@ -617,7 +617,7 @@ in_band_create(struct ofproto *ofproto, struct dpif *dpif, return error; } - error = netdev_open(local_name, NETDEV_ETH_TYPE_NONE, &local_netdev); + error = netdev_open_default(local_name, &local_netdev); if (error) { VLOG_ERR("failed to initialize in-band control: cannot open " "datapath local port %s (%s)", local_name, strerror(error));