]>
Commit | Line | Data |
---|---|---|
e735f4d4 MP |
1 | #pragma once |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
6 | Copyright (C) 2015 Tom Gundersen <teg@jklmen> | |
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 | ||
db2df898 | 22 | #include "sd-id128.h" |
e735f4d4 MP |
23 | |
24 | #include "macro.h" | |
25 | #include "sparse-endian.h" | |
e3bff60a | 26 | #include "unaligned.h" |
e735f4d4 MP |
27 | |
28 | /* RFC 3315 section 9.1: | |
29 | * A DUID can be no more than 128 octets long (not including the type code). | |
30 | */ | |
31 | #define MAX_DUID_LEN 128 | |
32 | ||
33 | struct duid { | |
34 | uint16_t type; | |
35 | union { | |
36 | struct { | |
37 | /* DHCP6_DUID_LLT */ | |
38 | uint16_t htype; | |
39 | uint32_t time; | |
40 | uint8_t haddr[0]; | |
41 | } _packed_ llt; | |
42 | struct { | |
43 | /* DHCP6_DUID_EN */ | |
44 | uint32_t pen; | |
45 | uint8_t id[8]; | |
46 | } _packed_ en; | |
47 | struct { | |
48 | /* DHCP6_DUID_LL */ | |
49 | int16_t htype; | |
50 | uint8_t haddr[0]; | |
51 | } _packed_ ll; | |
52 | struct { | |
53 | /* DHCP6_DUID_UUID */ | |
54 | sd_id128_t uuid; | |
55 | } _packed_ uuid; | |
56 | struct { | |
57 | uint8_t data[MAX_DUID_LEN]; | |
58 | } _packed_ raw; | |
59 | }; | |
60 | } _packed_; | |
61 | ||
62 | int dhcp_identifier_set_duid_en(struct duid *duid, size_t *len); | |
e3bff60a | 63 | int dhcp_identifier_set_iaid(int ifindex, uint8_t *mac, size_t mac_len, void *_id); |