[ovs-dev] openflow-1.0 : controller's port number in in-band controll

Tetsuo NAKAGAWA nakagawa at mxc.nes.nec.co.jp
Thu Feb 25 17:36:25 PST 2010


Hi.

I'm using Open vSwitch with openflow-1.0 branch.

There is following description in ovs-vswitchd(5) man page.

   OpenFlow Controller Connectivity
       ovs-vswitchd  can  perform all configured bridging
       and switching locally, or it can be configured to
       connect a given bridge to an external OpenFlow
       controller, such as NOX.  Its behavior depends on the
       bridge.name.controller setting:


  (snip)

       ssl:ip[:port]
              The specified SSL port (default: 6633) on the
              host at the given ip, which must be expressed
              as an IP address (not a DNS name).  SSL must
              be configured when this form is used (see SSL
              Configuration, below).

       tcp:ip[:port]
              The specified TCP port (default: 6633) on the
              host at the given ip, which must be expressed
              as an IP address (not a DNS name).

These description has means also available except for 6633
as controller's port number.

But ovs-vswitchd's in-band controll expects only 6633.

ofproto/in-band.c is as follows.

  void
  in_band_run(struct in_band *in_band)
  {
      time_t now = time_now();
      uint32_t controller_ip;
      const uint8_t *remote_mac;
      const uint8_t *local_mac;
      flow_t flow;
  
      if (now < in_band->next_remote_refresh
              && now < in_band->next_local_refresh) {
          return;
      }
  
      controller_ip = rconn_get_remote_ip(in_band->controller);
      if (in_band->controller_ip && controller_ip != in_band->controller_ip) {
          VLOG_DBG("controller IP address changed from "IP_FMT" to "IP_FMT,
                   IP_ARGS(&in_band->controller_ip),
                   IP_ARGS(&controller_ip));
      }
      in_band->controller_ip = controller_ip;
  
    (snip)
  
      if (controller_ip) {
  
    (snip)
  
          /* OpenFlow traffic to or from the controller.
           *
           * (A given field's value is completely ignored if it is wildcarded,
           * which is why we can get away with using a single 'flow' in each
           * case here.) */
          memset(&flow, 0, sizeof flow);
          flow.dl_type = htons(ETH_TYPE_IP);
          flow.nw_proto = IP_TYPE_TCP;
          flow.nw_src = controller_ip;
          flow.nw_dst = controller_ip;
          flow.tp_src = htons(OFP_TCP_PORT);  <-- !! here
          flow.tp_dst = htons(OFP_TCP_PORT);  <-- !! here
          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);

OFP_TCP_PORT is defined as 6633.

  #define OFP_TCP_PORT  6633
  #define OFP_SSL_PORT  6633

Therefore when the number except for 6633 was specified as
controller's port number, ovs-vswitchd can't communicate
with controller any more.

The patch to this defect is as follows.

  --- ./openvswitch-openflow-1.0-20100216.org/ofproto/in-band.c   2010-02-13 06:18:45.000000000 +0900
  +++ ./openvswitch-openflow-1.0-20100216/ofproto/in-band.c       2010-02-24 11:49:39.000000000 +0900
  @@ -452,6 +452,7 @@
   {
       time_t now = time_now();
       uint32_t controller_ip;
  +    uint16_t controller_port;
       const uint8_t *remote_mac;
       const uint8_t *local_mac;
       flow_t flow;
  @@ -471,6 +472,7 @@
   
       remote_mac = get_remote_mac(in_band);
       local_mac = get_local_mac(in_band);
  +    controller_port = rconn_get_remote_port(in_band->controller);
   
       if (local_mac) {
           /* Allow DHCP requests to be sent from the local port. */
  @@ -560,8 +562,8 @@
           flow.nw_proto = IP_TYPE_TCP;
           flow.nw_src = controller_ip;
           flow.nw_dst = controller_ip;
  -        flow.tp_src = htons(OFP_TCP_PORT);
  -        flow.tp_dst = htons(OFP_TCP_PORT);
  +        flow.tp_src = controller_port;
  +        flow.tp_dst = controller_port;
           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);

There is also same defect in master, next branch.


best regards,

--- Tetsuo NAKAGAWA





More information about the dev mailing list