]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/arphrd-list.c
license: LGPL-2.1+ -> LGPL-2.1-or-later
[thirdparty/systemd.git] / src / basic / arphrd-list.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include <errno.h>
4 #include <linux/if_arp.h>
5 #include <string.h>
6
7 #include "arphrd-list.h"
8 #include "macro.h"
9
10 static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len);
11
12 #include "arphrd-from-name.h"
13 #include "arphrd-to-name.h"
14
15 int arphrd_from_name(const char *name) {
16 const struct arphrd_name *sc;
17
18 assert(name);
19
20 sc = lookup_arphrd(name, strlen(name));
21 if (!sc)
22 return -EINVAL;
23
24 return sc->id;
25 }