Print this page
    
Interpret sl3a_uport == 0 in SVP_R_VL3_ACK to indicate the VL3 IP is a
next-hop router.
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/lib/varpd/svp/common/libvarpd_svp_prot.h
          +++ new/usr/src/lib/varpd/svp/common/libvarpd_svp_prot.h
   1    1  /*
   2    2   * This file and its contents are supplied under the terms of the
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13   13   * Copyright 2018 Joyent, Inc.
  14   14   */
  15   15  
  16   16  #ifndef _LIBVARPD_SVP_PROT_H
  17   17  #define _LIBVARPD_SVP_PROT_H
  18   18  
  19   19  /*
  20   20   * SVP protocol Definitions
  21   21   */
  22   22  
  23   23  #include <sys/types.h>
  24   24  #include <inttypes.h>
  25   25  #include <sys/ethernet.h>
  26   26  #include <netinet/in.h>
  27   27  
  28   28  #ifdef __cplusplus
  29   29  extern "C" {
  30   30  #endif
  31   31  
  32   32  /*
  33   33   * SDC VXLAN Protocol Definitions
  34   34   */
  35   35  
  36   36  #define SVP_VERSION_ONE 1
  37   37  #define SVP_VERSION_TWO 2
  38   38  /* XXX KEBE SAYS -- we are not yet ready to bump this. */
  39   39  #define SVP_CURRENT_VERSION     SVP_VERSION_ONE
  40   40  
  41   41  typedef struct svp_req {
  42   42          uint16_t        svp_ver;
  43   43          uint16_t        svp_op;
  44   44          uint32_t        svp_size;
  45   45          uint32_t        svp_id;
  46   46          uint32_t        svp_crc32;
  47   47  } svp_req_t;
  48   48  
  49   49  typedef enum svp_op {
  50   50          SVP_R_UNKNOWN           = 0x00,
  51   51          SVP_R_PING              = 0x01,
  52   52          SVP_R_PONG              = 0x02,
  53   53          SVP_R_VL2_REQ           = 0x03,
  54   54          SVP_R_VL2_ACK           = 0x04,
  55   55          SVP_R_VL3_REQ           = 0x05,
  56   56          SVP_R_VL3_ACK           = 0x06,
  57   57          SVP_R_BULK_REQ          = 0x07,
  58   58          SVP_R_BULK_ACK          = 0x08,
  59   59          SVP_R_LOG_REQ           = 0x09,
  60   60          SVP_R_LOG_ACK           = 0x0A,
  61   61          SVP_R_LOG_RM            = 0x0B,
  62   62          SVP_R_LOG_RM_ACK        = 0x0C,
  63   63          SVP_R_SHOOTDOWN         = 0x0D,
  64   64          SVP_R_ROUTE_REQ         = 0x0E,
  65   65          SVP_R_ROUTE_ACK         = 0x0F
  66   66  } svp_op_t;
  
    | 
      ↓ open down ↓ | 
    66 lines elided | 
    
      ↑ open up ↑ | 
  
  67   67  
  68   68  typedef enum svp_status {
  69   69          SVP_S_OK        = 0x00, /* Everything OK */
  70   70          SVP_S_FATAL     = 0x01, /* Fatal error, close connection */
  71   71          SVP_S_NOTFOUND  = 0x02, /* Entry not found */
  72   72          SVP_S_BADL3TYPE = 0x03, /* Unknown svp_vl3_type_t */
  73   73          SVP_S_BADBULK   = 0x04  /* Unknown svp_bulk_type_t */
  74   74  } svp_status_t;
  75   75  
  76   76  /*
  77      - * A client issues the SVP_R_VL2_REQ whenever it needs to perform a VLS->UL3
       77 + * A client issues the SVP_R_VL2_REQ whenever it needs to perform a VL2->UL3
  78   78   * lookup. Requests have the following structure:
  79   79   */
  80   80  typedef struct svp_vl2_req {
  81   81          uint8_t         sl2r_mac[ETHERADDRL];
  82   82          uint8_t         sl2r_pad[2];
  83   83          uint32_t        sl2r_vnetid;
  84   84  } svp_vl2_req_t;
  85   85  
  86   86  /*
  87   87   * This is the message a server uses to reply to the SVP_R_VL2_REQ.  If the
  88   88   * destination on the underlay is an IPv4 address, it should be encoded as an
  89   89   * IPv4-mapped IPv6 address.
  90   90   */
  91   91  typedef struct svp_vl2_ack {
  92   92          uint16_t        sl2a_status;
  93   93          uint16_t        sl2a_port;
  94   94          uint8_t         sl2a_addr[16];
  95   95  } svp_vl2_ack_t;
  96   96  
  97   97  
  98   98  /*
  99   99   * A client issues the SVP_R_VL3_REQ request whenever it needs to perform a
 100  100   * VL3->VL2 lookup.  Note, that this also implicitly performs a VL2->UL3 lookup
 101  101   * as well. The sl3r_type member is used to indicate the kind of lookup type
 102  102   * that we're performing, eg. is it a L3 or L2.
 103  103   */
 104  104  typedef enum svp_vl3_type {
 105  105          SVP_VL3_IP      = 0x01,
 106  106          SVP_VL3_IPV6    = 0x02
 107  107  } svp_vl3_type_t;
 108  108  
 109  109  typedef struct svp_vl3_req {
 110  110          uint8_t         sl3r_ip[16];
 111  111          uint32_t        sl3r_type;
 112  112          uint32_t        sl3r_vnetid;
 113  113  } svp_vl3_req_t;
 114  114  
 115  115  /*
 116  116   * This response, corresponding to the SVP_R_VL3_ACK, includes an answer to both
 117  117   * the VL3->VL2 and the VL2->UL3 requests.
 118  118   */
 119  119  typedef struct svp_vl3_ack {
 120  120          uint32_t        sl3a_status;
 121  121          uint8_t         sl3a_mac[ETHERADDRL];
 122  122          uint16_t        sl3a_uport;
 123  123          uint8_t         sl3a_uip[16];
 124  124  } svp_vl3_ack_t;
 125  125  
 126  126  /*
 127  127   * SVP_R_BULK_REQ requests a bulk dump of data. Currently we have two kinds of
 128  128   * data tables that we need to dump: VL3->VL2 mappings and VL2->UL3 mappings.
 129  129   * The kind that we want is indicated using the svbr_type member.
 130  130   */
 131  131  typedef enum svp_bulk_type {
 132  132          SVP_BULK_VL2    = 0x01,
 133  133          SVP_BULK_VL3    = 0x02
 134  134  } svp_bulk_type_t;
 135  135  
 136  136  typedef struct svp_bulk_req {
 137  137          uint32_t        svbr_type;
 138  138  } svp_bulk_req_t;
 139  139  
 140  140  /*
 141  141   * When replying to a bulk request (SVP_R_BULK_ACK), data is streamed back
 142  142   * across.  The format of the data is currently undefined and as we work on the
 143  143   * system, we'll get a better understanding of what this should look like. A
 144  144   * client may need to stream such a request to disk, or the format will need to
 145  145   * be in a streamable format that allows the client to construct data.
 146  146   */
 147  147  typedef struct svp_bulk_ack {
 148  148          uint32_t        svba_status;
 149  149          uint32_t        svba_type;
 150  150          uint8_t         svba_data[];
 151  151  } svp_bulk_ack_t;
 152  152  
 153  153  /*
 154  154   * SVP_R_LOG_REQ requests a log entries from the specified log from the server.
 155  155   * The total number of bytes that the user is ready to receive is in svlr_count.
 156  156   * However, the server should not block for data if none is available and thus
 157  157   * may return less than svlr_count bytes back. We identify the IP address of the
 158  158   * underlay to use here explicitly.
 159  159   */
 160  160  typedef struct svp_log_req {
 161  161          uint32_t        svlr_count;
 162  162          uint8_t         svlr_ip[16];
 163  163  } svp_log_req_t;
 164  164  
 165  165  /*
 166  166   * The server replies to a log request by sending a series of log entries.
 167  167   * These log entries may be a mixture of both vl2 and vl3 records. The reply is
 168  168   * a stream of bytes after the status message whose length is determined baseed
 169  169   * on the header itself. Each entry begins with a uint32_t that describes its
 170  170   * type and then is followed by the remaining data payload. The next entry
 171  171   * follows immediately which again begins with the uint32_t word that describes
 172  172   * what it should be.
 173  173   */
 174  174  typedef enum svp_log_type {
 175  175          SVP_LOG_VL2     = 0x01,
 176  176          SVP_LOG_VL3     = 0x02
 177  177  } svp_log_type_t;
 178  178  
 179  179  typedef struct svp_log_vl2 {
 180  180          uint32_t        svl2_type;      /* Should be SVP_LOG_VL2 */
 181  181          uint8_t         svl2_id[16];    /* 16-byte UUID */
 182  182          uint8_t         svl2_mac[ETHERADDRL];
 183  183          uint8_t         svl2_pad[2];
 184  184          uint32_t        svl2_vnetid;
 185  185  } svp_log_vl2_t;
 186  186  
 187  187  typedef struct svp_log_vl3 {
 188  188          uint32_t        svl3_type;      /* Should be SVP_LOG_VL3 */
 189  189          uint8_t         svl3_id[16];    /* 16-byte UUID */
 190  190          uint8_t         svl3_ip[16];
 191  191          uint8_t         svl3_pad[2];
 192  192          uint16_t        svl3_vlan;
 193  193          uint32_t        svl3_vnetid;
 194  194  } svp_log_vl3_t;
 195  195  
 196  196  typedef struct svp_log_ack {
 197  197          uint32_t        svla_status;
 198  198          uint8_t         svla_data[];
 199  199  } svp_log_ack_t;
 200  200  
 201  201  /*
 202  202   * SVP_R_LOG_RM is used after the client successfully processes a series of the
 203  203   * log stream. It replies to tell the server that it can remove those IDs from
 204  204   * processing. The IDs used are the same IDs that were in the individual
 205  205   * SVP_R_LOG_ACK entries.
 206  206   */
 207  207  typedef struct svp_lrm_req {
 208  208          uint32_t        svrr_count;
 209  209          uint8_t         svrr_ids[];
 210  210  } svp_lrm_req_t;
 211  211  
 212  212  /*
 213  213   * SVP_R_LOG_RM_ACK is used to indicate that a log entry has been successfully
 214  214   * deleted and at this point it makes sense to go and ask for another
 215  215   * SVP_R_LOG_REQ.
 216  216   */
 217  217  typedef struct svp_lrm_ack {
 218  218          uint32_t        svra_status;
 219  219  } svp_lrm_ack_t;
 220  220  
 221  221  /*
 222  222   * A shootdown (SVP_R_SHOOTDOWN) is used by a CN to reply to another CN that it
 223  223   * sent an invalid entry that could not be processed. This should be a
 224  224   * relatively infrequent occurrence. Unlike the rest of the messages, there is
 225  225   * no reply to it. It's a single request to try and help get us out there. When
 226  226   * a node receives this, it will issue a conditional revocation ioctl, that
 227  227   * removes the entry if and only if, it matches the IP. That way if we've
 228  228   * already gotten an updated entry for this, we don't remove it again.
 229  229   */
 230  230  typedef struct svp_shootdown {
 231  231          uint8_t         svsd_mac[ETHERADDRL];
 232  232          uint8_t         svsd_pad[2];
 233  233          uint32_t        svsd_vnetid;
 234  234  } svp_shootdown_t;
 235  235  
 236  236  /*
 237  237   * A route-request (SVP_R_ROUTE_REQ) queries the local SVP server to get a
 238  238   * far-remote (i.e. another Triton Data Center, nee. SDC) SVP server for
 239  239   * far-remote networks.  Modern overlay modules will request IP destinations
 240  240   * for remote-Triton networks, but they must know how to reach the
 241  241   * remote-Triton SVP server.
 242  242   */
 243  243  typedef struct svp_route_req {
 244  244          uint32_t        srr_vnetid;     /* Requester's vnet ID. */
 245  245          uint16_t        srr_vlan;       /* Requester's VLAN ID. */
  
    | 
      ↓ open down ↓ | 
    158 lines elided | 
    
      ↑ open up ↑ | 
  
 246  246          uint16_t        srr_pad;        /* Zero on xmit, ignore on receipt. */
 247  247          uint8_t         srr_srcip[16];  /* VL3 Source IP. */
 248  248          uint8_t         srr_dstip[16];  /* VL3 Destination IP. */
 249  249  } svp_route_req_t;
 250  250  
 251  251  /*
 252  252   * The far-remote Triton Data Center will answer with the requisite information
 253  253   * to send overlay packets to the appropriate far-remote CNs.
 254  254   */
 255  255  typedef struct svp_route_ack {
      256 +        uint32_t        sra_status;     /* Status. */
 256  257          uint32_t        sra_dcid;       /* Far-remote Data Center ID. */
 257  258          uint32_t        sra_vnetid;     /* Far-remote vnet ID. */
 258  259          uint16_t        sra_vlan;       /* Far-remote VLAN ID. */
 259  260          uint16_t        sra_port;       /* Destination UL3 port. */
 260  261          uint8_t         sra_ip[16];     /* Destination UL3 address. */
 261  262          uint8_t sra_srcmac[ETHERADDRL]; /* Far-remote VL2 source. */
 262  263          uint8_t sra_dstmac[ETHERADDRL]; /* Far-remote VL2 dest. */
 263  264          uint8_t         sra_src_pfx;    /* Far-remote VL3 source prefix */
 264  265          uint8_t         sra_dst_pfx;    /* Far-remote VL3 dest. prefix */
 265  266  } svp_route_ack_t;
 266  267  
 267  268  #ifdef __cplusplus
 268  269  }
 269  270  #endif
 270  271  
 271  272  #endif /* _LIBVARPD_SVP_PROT_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX