Deleted Added
full compact
ifconfig.c (301059) ifconfig.c (301185)
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

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

33 The Regents of the University of California. All rights reserved.\n";
34#endif /* not lint */
35
36#ifndef lint
37#if 0
38static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
39#endif
40static 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

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

33 The Regents of the University of California. All rights reserved.\n";
34#endif /* not lint */
35
36#ifndef lint
37#if 0
38static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
39#endif
40static const char rcsid[] =
41 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 301059 2016-05-31 17:30:08Z allanjude $";
41 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 301185 2016-06-02 03:16:02Z allanjude $";
42#endif /* not lint */
43
44#include <sys/param.h>
45#include <sys/ioctl.h>
46#include <sys/module.h>
47#include <sys/linker.h>
48#include <sys/queue.h>
49#include <sys/socket.h>

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

94int verbose;
95int noload;
96int printifname = 0;
97
98int supmedia = 0;
99int printkeys = 0; /* Print keying material for interfaces. */
100
101/* Formatter Strings */
42#endif /* not lint */
43
44#include <sys/param.h>
45#include <sys/ioctl.h>
46#include <sys/module.h>
47#include <sys/linker.h>
48#include <sys/queue.h>
49#include <sys/socket.h>

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

94int verbose;
95int noload;
96int printifname = 0;
97
98int supmedia = 0;
99int printkeys = 0; /* Print keying material for interfaces. */
100
101/* Formatter Strings */
102char *f_inet, *f_inet6, *f_ether, *f_addr, *f_scope;
102char *f_inet, *f_inet6, *f_ether, *f_addr;
103
104static int ifconfig(int argc, char *const *argv, int iscreate,
105 const struct afswtch *afp);
106static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
107 struct ifaddrs *ifa);
108static void tunnel_status(int s);
109static void usage(void);
110

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

252 if (f_inet != NULL)
253 free(f_inet);
254 if (f_inet6 != NULL)
255 free(f_inet6);
256 if (f_ether != NULL)
257 free(f_ether);
258 if (f_addr != NULL)
259 free(f_addr);
103
104static int ifconfig(int argc, char *const *argv, int iscreate,
105 const struct afswtch *afp);
106static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
107 struct ifaddrs *ifa);
108static void tunnel_status(int s);
109static void usage(void);
110

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

252 if (f_inet != NULL)
253 free(f_inet);
254 if (f_inet6 != NULL)
255 free(f_inet6);
256 if (f_ether != NULL)
257 free(f_ether);
258 if (f_addr != NULL)
259 free(f_addr);
260 if (f_scope != NULL)
261 free(f_scope);
262}
263
264static void setformat(char *input)
265{
266 char *formatstr, *category, *modifier;
267
268 formatstr = strdup(input);
269 while ((category = strsep(&formatstr, ",")) != NULL) {

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

281 if (strcmp(category, "addr") == 0)
282 f_addr = strdup(modifier);
283 else if (strcmp(category, "ether") == 0)
284 f_ether = strdup(modifier);
285 else if (strcmp(category, "inet") == 0)
286 f_inet = strdup(modifier);
287 else if (strcmp(category, "inet6") == 0)
288 f_inet6 = strdup(modifier);
260}
261
262static void setformat(char *input)
263{
264 char *formatstr, *category, *modifier;
265
266 formatstr = strdup(input);
267 while ((category = strsep(&formatstr, ",")) != NULL) {

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

279 if (strcmp(category, "addr") == 0)
280 f_addr = strdup(modifier);
281 else if (strcmp(category, "ether") == 0)
282 f_ether = strdup(modifier);
283 else if (strcmp(category, "inet") == 0)
284 f_inet = strdup(modifier);
285 else if (strcmp(category, "inet6") == 0)
286 f_inet6 = strdup(modifier);
289 else if (strcmp(category, "scope") == 0)
290 f_scope = strdup(modifier);
291 }
292 free(formatstr);
293}
294
295#undef ORDERS_SIZE
296
297static struct ifaddrs *
298sortifaddrs(struct ifaddrs *list,

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

367 char options[1024], *cp, *envformat, *namecp = NULL;
368 struct ifa_queue q = TAILQ_HEAD_INITIALIZER(q);
369 struct ifa_order_elt *cur, *tmp;
370 const char *ifname;
371 struct option *p;
372 size_t iflen;
373
374 all = downonly = uponly = namesonly = noload = verbose = 0;
287 }
288 free(formatstr);
289}
290
291#undef ORDERS_SIZE
292
293static struct ifaddrs *
294sortifaddrs(struct ifaddrs *list,

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

363 char options[1024], *cp, *envformat, *namecp = NULL;
364 struct ifa_queue q = TAILQ_HEAD_INITIALIZER(q);
365 struct ifa_order_elt *cur, *tmp;
366 const char *ifname;
367 struct option *p;
368 size_t iflen;
369
370 all = downonly = uponly = namesonly = noload = verbose = 0;
375 f_inet = f_inet6 = f_ether = f_addr = f_scope = NULL;
371 f_inet = f_inet6 = f_ether = f_addr = NULL;
376
377 envformat = getenv("IFCONFIG_FORMAT");
378 if (envformat != NULL)
379 setformat(envformat);
380
381 /*
382 * Ensure we print interface name when expected to,
383 * even if we terminate early due to error.

--- 1091 unchanged lines hidden ---
372
373 envformat = getenv("IFCONFIG_FORMAT");
374 if (envformat != NULL)
375 setformat(envformat);
376
377 /*
378 * Ensure we print interface name when expected to,
379 * even if we terminate early due to error.

--- 1091 unchanged lines hidden ---