1 /*
2  * dhcpcd - DHCP client daemon
3  * Copyright (c) 2006-2015 Roy Marples <roy@marples.name>
4  * All rights reserved
5 
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #include <sys/utsname.h>
29 
30 #include <errno.h>
31 #include <fcntl.h>
32 #include <unistd.h>
33 
34 #include "config.h"
35 #include "common.h"
36 #include "dhcp.h"
37 #include "if.h"
38 #include "if-options.h"
39 #include "ipv4.h"
40 #include "ipv6.h"
41 #include "ipv6nd.h"
42 
43 int
if_init(__unused struct interface * iface)44 if_init(__unused struct interface *iface)
45 {
46 
47 	return 0;
48 }
49 
50 int
if_conf(__unused struct interface * iface)51 if_conf(__unused struct interface *iface)
52 {
53 
54 	return 0;
55 }
56 
57 int
if_openlinksocket(void)58 if_openlinksocket(void)
59 {
60 
61 	errno = ENOTSUP;
62 	return -1;
63 }
64 
65 int
if_getssid(const char * ifname,char * ssid)66 if_getssid(const char *ifname, char *ssid)
67 {
68 
69 	errno = ENOTSUP;
70 	return -1;
71 }
72 
73 int
if_vimaster(const char * ifname)74 if_vimaster(const char *ifname)
75 {
76 
77 	return 0;
78 }
79 
80 #ifdef INET
81 int
if_openrawsocket(struct interface * ifp,int protocol)82 if_openrawsocket(struct interface *ifp, int protocol)
83 {
84 
85 	errno = ENOTSUP;
86 	return -1;
87 }
88 
89 ssize_t
if_sendrawpacket(const struct interface * ifp,int protocol,const void * data,size_t len)90 if_sendrawpacket(const struct interface *ifp, int protocol,
91     const void *data, size_t len)
92 {
93 
94 	errno = ENOTSUP;
95 	return -1;
96 }
97 
98 ssize_t
if_readrawpacket(struct interface * ifp,int protocol,void * data,size_t len,int * flags)99 if_readrawpacket(struct interface *ifp, int protocol,
100     void *data, size_t len, int *flags)
101 {
102 
103 	errno = ENOTSUP;
104 	return -1;
105 }
106 
107 int
if_address(const struct interface * iface,const struct in_addr * address,const struct in_addr * netmask,const struct in_addr * broadcast,int action)108 if_address(const struct interface *iface, const struct in_addr *address,
109     const struct in_addr *netmask, const struct in_addr *broadcast,
110     int action)
111 {
112 
113 	errno = ENOTSUP;
114 	return -1;
115 }
116 
117 int
if_route(const struct rt * rt,int action)118 if_route(const struct rt *rt, int action)
119 {
120 
121 	errno = ENOTSUP;
122 	return -1;
123 }
124 #endif
125 
126 #ifdef INET6
127 int
if_address6(const struct ipv6_addr * a,int action)128 if_address6(const struct ipv6_addr *a, int action)
129 {
130 
131 	errno = ENOTSUP;
132 	return -1;
133 }
134 
135 int
if_route6(const struct rt6 * rt,int action)136 if_route6(const struct rt6 *rt, int action)
137 {
138 
139 	errno = ENOTSUP;
140 	return -1;
141 }
142 #endif
143 
144 #ifdef INET6
145 int
if_addrflags6(const struct in6_addr * addr,const struct interface * ifp)146 if_addrflags6(const struct in6_addr *addr, const struct interface *ifp)
147 {
148 
149 	errno = ENOTSUP;
150 	return -1;
151 }
152 #endif
153 
154 int
if_managelink(struct dhcpcd_ctx * ctx)155 if_managelink(struct dhcpcd_ctx *ctx)
156 {
157 
158 	errno = ENOTSUP;
159 	return -1;
160 }
161 
if_machinearch(char * str,size_t len)162 if_machinearch(char *str, size_t len)
163 {
164 
165 	errno = ENOTSUP;
166 	return -1;
167 }
168 
169 #ifdef INET6
170 void
if_rarestore(struct dhcpcd_ctx * ctx)171 if_rarestore(struct dhcpcd_ctx *ctx)
172 {
173 
174 }
175 
176 int
if_checkipv6(struct dhcpcd_ctx * ctx,const char * ifname,int own)177 if_checkipv6(struct dhcpcd_ctx *ctx, const char *ifname, int own)
178 {
179 
180 	errno = ENOTSUP;
181 	return -1;
182 }
183 #endif
184