Overview

Currently ip2nets parameter is parsed in the kernel, which is not desirable. This is being deprecated in the Multi-Rail code and all parsing will occur in user-space in the DLC library. Once ip2nets syntax is parsed, the DLC library will configure the networks through the standard IOCTL interface.

This page will outline how ip2nets behaves.

Technical Summary

ip2nets in DLC can be specified only through the YAML interface. Below is the YAML syntax for ip2nets:

/*
* ip2nets:
*  - net-spec: <tcp|o2ib|gni>[NUM]
*    interfaces:
*        0: <intf name>['['<expr>']']
*        1: <intf name>['['<expr>']']
*    ip-range:
*        0: <expr.expr.expr.expr>
*        1: <expr.expr.expr.expr>
*        N: <expr.expr.expr.expr>
*/


net-spec: specifies the network to be configured.
interfaces: This is an optional block. It specifies the list of interfaces to be configured. The expression enclosed in the following brackets describes the CPU partitions to bind the network interface to
ip-range: This is an optional block. It is a list of ip ranges to match the interfaces to. Each interface specified must match at least one of the ip-ranges.
 
The <net-spec> block can be specified multiple times to define multipe Networks to configure.

When the ip2nets YAML block is parsed each interface and it's CPT expression is resolved and matched to the ip-ranges. The matching interfaces are configured under the network specified in net-spec.

Behavior

Each interface in the interfaces list is matched against the ip-range expression. The interface will only be configured if it matches at least one of the ip-range expressions.

If there are no ip-ranges specified, then all interfaces are configured in the network if they are currently UP.

If there are no interfaces specified but there are ip-ranges specified, then all available interfaces in the system are checked against the ip-ranges and the interfaces which match the ip-ranges are configured.

If neither the interfaces or ip-ranges are specified then the first interface available is configured.

Examples

Configure eth0, eth1 or eth2 only if they match the ip-range expression

ip2nets:
  - net-spec: tcp1
    interfaces:
         0: eth0
         1: eth1
         2: eth2
    ip-range:
         0: 192.168.122.*

Configure all interfaces in the system which match the ip-range

ip2nets:
  - net-spec: tcp1
    ip-range:
         0: 192.168.122.*

Configure eth0, eth1 or eth2 only if they match the ip-range and bind them to the specified CPTs

ip2nets:
  - net-spec: tcp1
    interfaces:
         0: eth0[1,2]
         1: eth1[0,1]
         2: eth2[2,3]
    ip-range:
         0: 192.168.122.*

Configure two networks tcp1 with eth0 if it matches the ip-range and tcp2 with eth1 and eth2 if it matches the ip-range

ip2nets:
  - net-spec: tcp1
    interfaces:
         0: eth0
    ip-range:
         0: 192.168.122.*
  - net-spec: tcp2
    interfaces:
         1: eth1
         2: eth2
    ip-range:
         0: 192.168.122.*

Configure eth0, eth1 or eth2 if they match the exact ip address

ip2nets:
  - net-spec: tcp1
    interfaces:
         0: eth0
         1: eth1
         2: eth2
    ip-range:
         0: 192.168.122.199

Configure eth0, eth1 and eth2 if they exist and they are up

ip2nets:
  - net-spec: tcp1
    interfaces:
         0: eth0
         1: eth1
         2: eth2

Configure the first interface available under tcp1

ip2nets:
  - net-spec: tcp1