go.ligato.io/vpp-agent/v3@v3.5.0/plugins/linux/l3plugin/linuxcalls/route_linuxcalls.go (about)

     1  //  Copyright (c) 2018 Cisco and/or its affiliates.
     2  //
     3  //  Licensed under the Apache License, Version 2.0 (the "License");
     4  //  you may not use this file except in compliance with the License.
     5  //  You may obtain a copy of the License at:
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  //  Unless required by applicable law or agreed to in writing, software
    10  //  distributed under the License is distributed on an "AS IS" BASIS,
    11  //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //  See the License for the specific language governing permissions and
    13  //  limitations under the License.
    14  
    15  //go:build !windows && !darwin
    16  
    17  package linuxcalls
    18  
    19  import (
    20  	"github.com/vishvananda/netlink"
    21  )
    22  
    23  // AddRoute creates the new static route
    24  func (h *NetLinkHandler) AddRoute(route *netlink.Route) error {
    25  	return netlink.RouteAdd(route)
    26  }
    27  
    28  // ReplaceRoute replaces the static route
    29  func (h *NetLinkHandler) ReplaceRoute(route *netlink.Route) error {
    30  	return netlink.RouteReplace(route)
    31  }
    32  
    33  // DelRoute removes the static route
    34  func (h *NetLinkHandler) DelRoute(route *netlink.Route) error {
    35  	return netlink.RouteDel(route)
    36  }