3 * IPV4 Local Link library with GLib integration
5 * Copyright (C) 2009-2010 Aldebaran Robotics. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #include <sys/socket.h>
28 #include <sys/types.h>
29 #include <netpacket/packet.h>
30 #include <net/ethernet.h>
31 #include <netinet/if_ether.h>
33 #include <arpa/inet.h>
38 #include "../src/connman.h"
41 * Return a random link local IP (in host byte order)
43 uint32_t ipv4ll_random_ip(void)
49 __connman_util_get_random(&rand);
51 tmp = tmp & IN_CLASSB_HOST;
52 } while (tmp > (IN_CLASSB_HOST - 0x0200));
53 return ((LINKLOCAL_ADDR + 0x0100) + tmp);