Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement connectioncontextkernel/ethernetcontext/getmac #34

Open
edwarnicke opened this issue Dec 2, 2020 · 0 comments
Open

Implement connectioncontextkernel/ethernetcontext/getmac #34

edwarnicke opened this issue Dec 2, 2020 · 0 comments
Labels
good first issue Good for newcomers

Comments

@edwarnicke
Copy link
Member

edwarnicke commented Dec 2, 2020

The Connection.ConnnectionContext.EthernetContext allows the NSE to specify the Source and Dest Mac address.

Because the Forwarder is generally the entity creating the interface for kernel mechanism, if the NSE has not already explicitly set the Dest Mac address (which should then be set correctly by #32), the Forwarder needs to get the mac address from the interface its created and set it in the EthernetContext.

Implementation notes:

  1. You need only implement the NetworkServiceServer in this case.
  2. Make sure to use a netlink.Handle for the NetNS of the NSE. This can be created using mechutils.ToNetlinkHandle. Example of use
  3. The netlink.Link on which you need to set the mac address can be retrieved using:
    handle.LinkByName(mechutils.ToInterfaceName(conn, isClient))
    
    Example of use
  4. netlink.Link.Attrs().HardwareAddr has the net.HardwareAddress for the interface.
  5. I would suggest adding a function to types in a mac.go file:
// ToVppMacAddress - converts *net.HardwareAddr to ethernet_types.MacAddress
func ToVppMacAddress(hardwareAddr *net.HardwareAddr) ethernet_types.MacAddress {
  hwAddr := [6]uint8{}
  copy(hwAddr[:], *hardwareAddr)
  return ethernet_types.MacAddress(hwAddr)
}

to convert net.HardwareAddr to the govpp ethernet_types.MacAddress (also suggested in #33)

  1. Once implemented, please add to the connectioncontextkernel/client.go and connectioncontextkernel/server.go.

Running end to end can be done using cmd-forwarder-vpp.

@edwarnicke edwarnicke changed the title Implement connectioncontextkernel/ethernetcontext/getmac/kernel Implement connectioncontextkernel/ethernetcontext/getmac Dec 2, 2020
@edwarnicke edwarnicke added the good first issue Good for newcomers label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant