func (cdh cniDaemonHandler) configureNic(podName, podNamespace, netns, containerID, mac string,
	netID *uint32, allocatedIPs map[networkingv1.IPVersion]*containernetwork.IPInfo, networkType networkingv1.NetworkType) (string, error) {
	var err error
	var nodeIfName string
	var mtu int
	switch networkType {
	case networkingv1.NetworkTypeUnderlay:
		mtu = cdh.config.VlanMTU
		nodeIfName = cdh.config.NodeVlanIfName
	case networkingv1.NetworkTypeOverlay:
		mtu = cdh.config.VxlanMTU
		nodeIfName = cdh.config.NodeVxlanIfName
	}
	macAddr, err := net.ParseMAC(mac)
	if err != nil {
		return "", fmt.Errorf("failed to parse mac %s %v", macAddr, err)
	}
	containerNicName, hostNicName, podNS, err := initContainerNic(podName, netns, containerID, mtu)
	if err != nil {
		return "", fmt.Errorf("init container nic for pod %v failed: %v", podName, err)
	}
	if err = containernetwork.ConfigureHostNic(hostNicName, allocatedIPs, cdh.config.LocalDirectTableNum); err != nil {
		return "", err
	}
	klog.Infof("Configure container nic for %v.%v", podName, podNamespace)
	if err = containernetwork.ConfigureContainerNic(containerNicName, hostNicName, nodeIfName,
		allocatedIPs, macAddr, netID, podNS, mtu, cdh.config.VlanCheckTimeout, networkType,
		cdh.config.NeighGCThresh1, cdh.config.NeighGCThresh2, cdh.config.NeighGCThresh3); err != nil {
		return "", fmt.Errorf("failed to configure container nic for %v.%v: %v", podName, podNamespace, err)
	}
	klog.Infof("Finish configuring container nic for %v.%v", podName, podNamespace)
	return hostNicName, nil
}
ipAddr is a CIDR notation IP address and prefix length
package server
import (
	"fmt"
	"net"
	networkingv1 "github.com/alibaba/hybridnet/pkg/apis/networking/v1"
	"github.com/alibaba/hybridnet/pkg/daemon/containernetwork"
	"github.com/containernetworking/plugins/pkg/ns"
	"github.com/vishvananda/netlink"
	"k8s.io/klog"
)