2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2014-08-12 01:41:42 +02:00
|
|
|
|
2018-11-28 09:54:04 +01:00
|
|
|
#include <errno.h>
|
2019-04-10 12:55:53 +02:00
|
|
|
#include <linux/if_arp.h>
|
2014-08-12 01:41:42 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "arphrd-list.h"
|
2015-11-30 21:43:37 +01:00
|
|
|
#include "macro.h"
|
2014-08-12 01:41:42 +02:00
|
|
|
|
2017-01-10 08:39:05 +01:00
|
|
|
static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len);
|
2014-08-12 01:41:42 +02:00
|
|
|
|
|
|
|
#include "arphrd-from-name.h"
|
2015-11-16 22:09:36 +01:00
|
|
|
#include "arphrd-to-name.h"
|
2014-08-12 01:41:42 +02:00
|
|
|
|
|
|
|
int arphrd_from_name(const char *name) {
|
|
|
|
const struct arphrd_name *sc;
|
|
|
|
|
|
|
|
assert(name);
|
|
|
|
|
|
|
|
sc = lookup_arphrd(name, strlen(name));
|
|
|
|
if (!sc)
|
2018-11-28 09:54:04 +01:00
|
|
|
return -EINVAL;
|
2014-08-12 01:41:42 +02:00
|
|
|
|
|
|
|
return sc->id;
|
|
|
|
}
|