]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/arphrd-util.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 #include <netinet/in.h>
5 #include <linux/if_arp.h>
6 #include <linux/if_infiniband.h>
9 #include "arphrd-util.h"
12 static const struct arphrd_name
* lookup_arphrd(register const char *str
, register GPERF_LEN_TYPE len
);
14 #include "arphrd-from-name.h"
15 #include "arphrd-to-name.h"
17 int arphrd_from_name(const char *name
) {
18 const struct arphrd_name
*sc
;
22 sc
= lookup_arphrd(name
, strlen(name
));
29 size_t arphrd_to_hw_addr_len(uint16_t arphrd
) {
33 case ARPHRD_INFINIBAND
:
34 return INFINIBAND_ALEN
;
38 return sizeof(struct in_addr
);
41 return sizeof(struct in6_addr
);