Deleted Added
full compact
af_inet.c (138593) af_inet.c (147437)
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_inet.c 138593 2004-12-08 19:18:07Z sam $";
32 "$FreeBSD: head/sbin/ifconfig/af_inet.c 147437 2005-06-16 19:37:09Z ume $";
33#endif /* not lint */
34
35#include <sys/types.h>
36#include <sys/ioctl.h>
37#include <sys/socket.h>
38#include <net/if.h>
39#include <net/route.h> /* for RTX_IFA */
40

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

148 struct ifreq ifr;
149 const struct sockaddr *sa = (const struct sockaddr *) &ifr.ifr_addr;
150
151 memset(&ifr, 0, sizeof(ifr));
152 strncpy(ifr.ifr_name, name, IFNAMSIZ);
153
154 if (ioctl(s, SIOCGIFPSRCADDR, (caddr_t)&ifr) < 0)
155 return;
33#endif /* not lint */
34
35#include <sys/types.h>
36#include <sys/ioctl.h>
37#include <sys/socket.h>
38#include <net/if.h>
39#include <net/route.h> /* for RTX_IFA */
40

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

148 struct ifreq ifr;
149 const struct sockaddr *sa = (const struct sockaddr *) &ifr.ifr_addr;
150
151 memset(&ifr, 0, sizeof(ifr));
152 strncpy(ifr.ifr_name, name, IFNAMSIZ);
153
154 if (ioctl(s, SIOCGIFPSRCADDR, (caddr_t)&ifr) < 0)
155 return;
156 if (sa->sa_family != AF_INET)
157 return;
156 if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, NI_NUMERICHOST) != 0)
157 src[0] = '\0';
158
159 if (ioctl(s, SIOCGIFPDSTADDR, (caddr_t)&ifr) < 0)
160 return;
158 if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, NI_NUMERICHOST) != 0)
159 src[0] = '\0';
160
161 if (ioctl(s, SIOCGIFPDSTADDR, (caddr_t)&ifr) < 0)
162 return;
163 if (sa->sa_family != AF_INET)
164 return;
161 if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, NI_NUMERICHOST) != 0)
162 dst[0] = '\0';
163
164 printf("\ttunnel inet %s --> %s\n", src, dst);
165}
166
167static void
168in_set_tunnel(int s, struct addrinfo *srcres, struct addrinfo *dstres)

--- 30 unchanged lines hidden ---
165 if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, NI_NUMERICHOST) != 0)
166 dst[0] = '\0';
167
168 printf("\ttunnel inet %s --> %s\n", src, dst);
169}
170
171static void
172in_set_tunnel(int s, struct addrinfo *srcres, struct addrinfo *dstres)

--- 30 unchanged lines hidden ---