LCOV - code coverage report
Current view: top level - network - networkd-netdev-ipvlan.c (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 1 19 5.3 %
Date: 2015-07-29 18:47:03 Functions: 2 5 40.0 %

          Line data    Source code
       1             : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
       2             : 
       3             : /***
       4             :   This file is part of systemd.
       5             : 
       6             :   Copyright 2013-2015 Tom Gundersen <teg@jklm.no>
       7             : 
       8             :   systemd is free software; you can redistribute it and/or modify it
       9             :   under the terms of the GNU Lesser General Public License as published by
      10             :   the Free Software Foundation; either version 2.1 of the License, or
      11             :   (at your option) any later version.
      12             : 
      13             :   systemd is distributed in the hope that it will be useful, but
      14             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      16             :   Lesser General Public License for more details.
      17             : 
      18             :   You should have received a copy of the GNU Lesser General Public License
      19             :   along with systemd; If not, see <http://www.gnu.org/licenses/>.
      20             : ***/
      21             : 
      22             : #include <net/if.h>
      23             : 
      24             : #include "networkd-netdev-ipvlan.h"
      25             : #include "conf-parser.h"
      26             : 
      27             : static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
      28             :         [NETDEV_IPVLAN_MODE_L2] = "L2",
      29             :         [NETDEV_IPVLAN_MODE_L3] = "L3",
      30             : };
      31             : 
      32           8 : DEFINE_STRING_TABLE_LOOKUP(ipvlan_mode, IPVlanMode);
      33           0 : DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_mode, ipvlan_mode, IPVlanMode, "Failed to parse ipvlan mode");
      34             : 
      35           0 : static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
      36           0 :         IPVlan *m = IPVLAN(netdev);
      37             :         int r;
      38             : 
      39           0 :         assert(netdev);
      40           0 :         assert(m);
      41           0 :         assert(link);
      42           0 :         assert(netdev->ifname);
      43             : 
      44           0 :         if (m->mode != _NETDEV_IPVLAN_MODE_INVALID) {
      45           0 :                 r = sd_netlink_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
      46           0 :                 if (r < 0)
      47           0 :                         return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPVLAN_MODE attribute: %m");
      48             :         }
      49             : 
      50           0 :         return 0;
      51             : }
      52             : 
      53           0 : static void ipvlan_init(NetDev *n) {
      54           0 :         IPVlan *m = IPVLAN(n);
      55             : 
      56           0 :         assert(n);
      57           0 :         assert(m);
      58             : 
      59           0 :         m->mode = _NETDEV_IPVLAN_MODE_INVALID;
      60           0 : }
      61             : 
      62             : const NetDevVTable ipvlan_vtable = {
      63             :         .object_size = sizeof(IPVlan),
      64             :         .init = ipvlan_init,
      65             :         .sections = "Match\0NetDev\0IPVLAN\0",
      66             :         .fill_message_create = netdev_ipvlan_fill_message_create,
      67             :         .create_type = NETDEV_CREATE_STACKED,
      68             : };

Generated by: LCOV version 1.11