Deleted Added
full compact
iface.c (76214) iface.c (78410)
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * 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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * 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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/ppp/iface.c 76214 2001-05-02 16:35:24Z brian $
26 * $FreeBSD: head/usr.sbin/ppp/iface.c 78410 2001-06-18 14:59:36Z brian $
27 */
28
29#include <sys/param.h>
30#include <sys/socket.h>
31#include <netinet/in.h>
32#include <net/if.h>
33#include <net/if_dl.h>
34#include <net/route.h>

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

158 dl = (struct sockaddr_dl *)(ifm + 1); /* Single _dl at end */
159 if (dl->sdl_nlen == namelen && !strncmp(name, dl->sdl_data, namelen)) {
160 iface = (struct iface *)malloc(sizeof *iface);
161 if (iface == NULL) {
162 fprintf(stderr, "iface_Create: malloc: %s\n", strerror(errno));
163 return NULL;
164 }
165 iface->name = strdup(name);
27 */
28
29#include <sys/param.h>
30#include <sys/socket.h>
31#include <netinet/in.h>
32#include <net/if.h>
33#include <net/if_dl.h>
34#include <net/route.h>

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

158 dl = (struct sockaddr_dl *)(ifm + 1); /* Single _dl at end */
159 if (dl->sdl_nlen == namelen && !strncmp(name, dl->sdl_data, namelen)) {
160 iface = (struct iface *)malloc(sizeof *iface);
161 if (iface == NULL) {
162 fprintf(stderr, "iface_Create: malloc: %s\n", strerror(errno));
163 return NULL;
164 }
165 iface->name = strdup(name);
166 iface->flags = ifm->ifm_flags;
167 iface->index = ifm->ifm_index;
166 iface->index = ifm->ifm_index;
167 iface->flags = ifm->ifm_flags;
168 iface->mtu = 0;
168 iface->in_addrs = 0;
169 iface->in_addr = NULL;
170 }
171 ptr += ifm->ifm_msglen; /* First ifa_msghdr */
172 for (; ptr < end; ptr += ifam->ifam_msglen) {
173 ifam = (struct ifa_msghdr *)ptr; /* Next if address */
174
175 if (ifam->ifam_type != RTM_NEWADDR) /* finished this if */

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

535
536 prompt_Printf(arg->prompt, "%s (idx %d) <", iface->name, iface->index);
537 for (f = 0; f < sizeof if_flags / sizeof if_flags[0]; f++)
538 if ((if_flags[f].flag & flags) || (!if_flags[f].flag && flags)) {
539 prompt_Printf(arg->prompt, "%s%s", flags == iface->flags ? "" : ",",
540 if_flags[f].value);
541 flags &= ~if_flags[f].flag;
542 }
169 iface->in_addrs = 0;
170 iface->in_addr = NULL;
171 }
172 ptr += ifm->ifm_msglen; /* First ifa_msghdr */
173 for (; ptr < end; ptr += ifam->ifam_msglen) {
174 ifam = (struct ifa_msghdr *)ptr; /* Next if address */
175
176 if (ifam->ifam_type != RTM_NEWADDR) /* finished this if */

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

536
537 prompt_Printf(arg->prompt, "%s (idx %d) <", iface->name, iface->index);
538 for (f = 0; f < sizeof if_flags / sizeof if_flags[0]; f++)
539 if ((if_flags[f].flag & flags) || (!if_flags[f].flag && flags)) {
540 prompt_Printf(arg->prompt, "%s%s", flags == iface->flags ? "" : ",",
541 if_flags[f].value);
542 flags &= ~if_flags[f].flag;
543 }
543 prompt_Printf(arg->prompt, "> mtu %d has %d address%s:\n", arg->bundle->mtu,
544 prompt_Printf(arg->prompt, "> mtu %d has %d address%s:\n", iface->mtu,
544 iface->in_addrs, iface->in_addrs == 1 ? "" : "es");
545
546 for (f = 0; f < iface->in_addrs; f++) {
547 prompt_Printf(arg->prompt, " %s", inet_ntoa(iface->in_addr[f].ifa));
548 if (iface->in_addr[f].bits >= 0)
549 prompt_Printf(arg->prompt, "/%d", iface->in_addr[f].bits);
550 if (iface->flags & IFF_POINTOPOINT)
551 prompt_Printf(arg->prompt, " -> %s", inet_ntoa(iface->in_addr[f].brd));

--- 27 unchanged lines hidden ---
545 iface->in_addrs, iface->in_addrs == 1 ? "" : "es");
546
547 for (f = 0; f < iface->in_addrs; f++) {
548 prompt_Printf(arg->prompt, " %s", inet_ntoa(iface->in_addr[f].ifa));
549 if (iface->in_addr[f].bits >= 0)
550 prompt_Printf(arg->prompt, "/%d", iface->in_addr[f].bits);
551 if (iface->flags & IFF_POINTOPOINT)
552 prompt_Printf(arg->prompt, " -> %s", inet_ntoa(iface->in_addr[f].brd));

--- 27 unchanged lines hidden ---