networkd-fdb.c revision ea6ec096db5f9f3562b9bbf438da7fe21411c74d
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright (C) 2014 Intel Corporation. All rights reserved.
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <ctype.h>
#include <net/ethernet.h>
#include "networkd.h"
#include "networkd-netdev.h"
#include "networkd-link.h"
#include "network-internal.h"
#include "path-util.h"
#include "conf-files.h"
#include "conf-parser.h"
#include "util.h"
/* create a new FDB entry or get an existing one. */
const unsigned section,
/* search entry in hashmap first. */
if(section) {
if (fdb_entry) {
return 0;
}
}
/* allocate space for MAC address. */
if (!mac_addr)
return -ENOMEM;
/* allocate space for and FDB entry. */
if (!fdb_entry) {
/* free previously allocated space for mac_addr. */
return -ENOMEM;
}
/* init FDB structure. */
if (section) {
}
/* return allocated FDB structure. */
return 0;
}
int r;
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
return 1;
}
/* send a request to the kernel to add a FDB entry in its static MAC table. */
int r;
/* create new RTM message */
if (r < 0)
return rtnl_log_create_error(r);
/* only NTF_SELF flag supported. */
if (r < 0)
return rtnl_log_create_error(r);
/* only NUD_PERMANENT state supported. */
if (r < 0)
return rtnl_log_create_error(r);
if (r < 0)
return rtnl_log_create_error(r);
/* VLAN Id is optional. We'll add VLAN Id only if it's specified. */
if (r < 0)
return rtnl_log_create_error(r);
}
/* send message to the kernel to update its internal static MAC table. */
if (r < 0) {
return r;
}
return 0;
}
/* remove and FDB entry. */
if(!fdb_entry)
return;
}
}
/* parse the HW address from config files. */
int config_parse_fdb_hwaddr(const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
int r;
if (r < 0) {
return r;
}
/* read in the MAC address for the FDB table. */
if (ETHER_ADDR_LEN != r) {
"Not a valid MAC address, ignoring assignment: %s", rvalue);
return 0;
}
return 0;
}
/* parse the VLAN Id from config files. */
int config_parse_fdb_vlan_id(const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
int r;
if (r < 0) {
return r;
}
if (r < 0) {
return r;
}
return 0;
}