dhcp-identifier.c revision 9ee18af3a036074c4021c82ae2e67f5ccaa9ea9d
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright (C) 2015 Tom Gundersen <teg@jklmen>
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 "sd-id128.h"
#include "libudev.h"
#include "udev-util.h"
#include "virt.h"
#include "sparse-endian.h"
#include "siphash24.h"
#include "dhcp6-protocol.h"
#include "dhcp-identifier.h"
#include "network-internal.h"
#define SYSTEMD_PEN 43793
int r;
r = sd_id128_get_machine(&machine_id);
if (r < 0)
return r;
/* a bit of snake-oil perhaps, but no need to expose the machine-id
directly */
return 0;
}
/* name is a pointer to memory in the udev_device struct, so must
have the same scope */
if (detect_container(NULL) <= 0) {
/* not in a container, udev will be around */
if (!udev)
return -ENOMEM;
if (device) {
if (udev_device_get_is_initialized(device) <= 0)
/* not yet ready */
return -EBUSY;
}
}
if (name)
else
/* fall back to MAC address if no predictable name available */
/* fold into 32 bits */
return 0;
}