Deleted Added
full compact
af_inet6.c (271307) af_inet6.c (278080)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#ifndef lint
31static const char rcsid[] =
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#ifndef lint
31static const char rcsid[] =
32 "$FreeBSD: head/sbin/ifconfig/af_inet6.c 271307 2014-09-09 10:52:50Z ae $";
32 "$FreeBSD: head/sbin/ifconfig/af_inet6.c 278080 2015-02-02 13:03:04Z vsevolod $";
33#endif /* not lint */
34
35#include <sys/param.h>
36#include <sys/ioctl.h>
37#include <sys/socket.h>
38#include <net/if.h>
39
40#include <err.h>

--- 121 unchanged lines hidden (view full) ---

162 errx(EXIT_FAILURE, "could not determine link local address");
163
164 memcpy(&in6->s6_addr[8], &lladdr->s6_addr[8], 8);
165
166 freeifaddrs(ifap);
167}
168
169static void
33#endif /* not lint */
34
35#include <sys/param.h>
36#include <sys/ioctl.h>
37#include <sys/socket.h>
38#include <net/if.h>
39
40#include <err.h>

--- 121 unchanged lines hidden (view full) ---

162 errx(EXIT_FAILURE, "could not determine link local address");
163
164 memcpy(&in6->s6_addr[8], &lladdr->s6_addr[8], 8);
165
166 freeifaddrs(ifap);
167}
168
169static void
170in6_print_scope(uint8_t *a)
171{
172 const char *sname = NULL;
173 uint16_t val;
174
175 val = (a[0] << 4) + ((a[1] & 0xc0) >> 4);
176
177 if ((val & 0xff0) == 0xff0)
178 sname = "Multicast";
179 else {
180 switch(val) {
181 case 0xfe8:
182 sname = "Link";
183 break;
184 case 0xfec:
185 sname = "Site";
186 break;
187 default:
188 sname = "Global";
189 break;
190 }
191 }
192
193 printf("scope: %s ", sname);
194}
195
196static void
170in6_status(int s __unused, const struct ifaddrs *ifa)
171{
172 struct sockaddr_in6 *sin, null_sin;
173 struct in6_ifreq ifr6;
174 int s6;
175 u_int32_t flags6;
176 struct in6_addrlifetime lifetime;
177 struct timespec now;

--- 74 unchanged lines hidden (view full) ---

252 printf("deprecated ");
253 if ((flags6 & IN6_IFF_AUTOCONF) != 0)
254 printf("autoconf ");
255 if ((flags6 & IN6_IFF_TEMPORARY) != 0)
256 printf("temporary ");
257 if ((flags6 & IN6_IFF_PREFER_SOURCE) != 0)
258 printf("prefer_source ");
259
197in6_status(int s __unused, const struct ifaddrs *ifa)
198{
199 struct sockaddr_in6 *sin, null_sin;
200 struct in6_ifreq ifr6;
201 int s6;
202 u_int32_t flags6;
203 struct in6_addrlifetime lifetime;
204 struct timespec now;

--- 74 unchanged lines hidden (view full) ---

279 printf("deprecated ");
280 if ((flags6 & IN6_IFF_AUTOCONF) != 0)
281 printf("autoconf ");
282 if ((flags6 & IN6_IFF_TEMPORARY) != 0)
283 printf("temporary ");
284 if ((flags6 & IN6_IFF_PREFER_SOURCE) != 0)
285 printf("prefer_source ");
286
260 if (((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id)
261 printf("scopeid 0x%x ",
262 ((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id);
287 in6_print_scope((uint8_t *)&((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_addr);
263
264 if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) {
265 printf("pltime ");
266 if (lifetime.ia6t_preferred) {
267 printf("%s ", lifetime.ia6t_preferred < now.tv_sec
268 ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec));
269 } else
270 printf("infty ");

--- 260 unchanged lines hidden ---
288
289 if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) {
290 printf("pltime ");
291 if (lifetime.ia6t_preferred) {
292 printf("%s ", lifetime.ia6t_preferred < now.tv_sec
293 ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec));
294 } else
295 printf("infty ");

--- 260 unchanged lines hidden ---