1/* $NetBSD: if_gre.c,v 1.42 2002/08/14 00:23:27 itojun Exp $ */
2/* $FreeBSD: head/sys/net/if_gre.c 122699 2003-11-14 20:58:00Z bms $ */
3
4/*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Heiko W.Rupp <hwr@pilhuhn.de>
10 *
--- 32 unchanged lines hidden (view full) ---
43 * If_gre is compatible with Cisco GRE tunnels, so you can
44 * have a NetBSD box as the other end of a tunnel interface of a Cisco
45 * router. See gre(4) for more details.
46 * Also supported: IP in IP encaps (proto 55) as of RFC 2004
47 */
48
49#include "opt_atalk.h"
50#include "opt_inet.h"
51#include "opt_inet6.h"
52
53#include <sys/param.h>
54#include <sys/kernel.h>
55#include <sys/malloc.h>
56#include <sys/mbuf.h>
57#include <sys/protosw.h>
58#include <sys/socket.h>
59#include <sys/sockio.h>
--- 521 unchanged lines hidden (view full) ---
581 si.sin_family = AF_INET;
582 si.sin_len = sizeof(struct sockaddr_in);
583 si.sin_addr.s_addr = sc->g_src.s_addr;
584 memcpy(&lifr->addr, &si, sizeof(si));
585 si.sin_addr.s_addr = sc->g_dst.s_addr;
586 memcpy(&lifr->dstaddr, &si, sizeof(si));
587 break;
588 case SIOCGIFPSRCADDR:
589#ifdef INET6
590 case SIOCGIFPSRCADDR_IN6:
591#endif
592 if (sc->g_src.s_addr == INADDR_ANY) {
593 error = EADDRNOTAVAIL;
594 break;
595 }
596 memset(&si, 0, sizeof(si));
597 si.sin_family = AF_INET;
598 si.sin_len = sizeof(struct sockaddr_in);
599 si.sin_addr.s_addr = sc->g_src.s_addr;
600 bcopy(&si, &ifr->ifr_addr, sizeof(ifr->ifr_addr));
601 break;
602 case SIOCGIFPDSTADDR:
603#ifdef INET6
604 case SIOCGIFPDSTADDR_IN6:
605#endif
606 if (sc->g_dst.s_addr == INADDR_ANY) {
607 error = EADDRNOTAVAIL;
608 break;
609 }
610 memset(&si, 0, sizeof(si));
611 si.sin_family = AF_INET;
612 si.sin_len = sizeof(struct sockaddr_in);
613 si.sin_addr.s_addr = sc->g_dst.s_addr;
--- 143 unchanged lines hidden ---
2/* $FreeBSD: head/sys/net/if_gre.c 122699 2003-11-14 20:58:00Z bms $ */
3
4/*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Heiko W.Rupp <hwr@pilhuhn.de>
10 *
--- 32 unchanged lines hidden (view full) ---
43 * If_gre is compatible with Cisco GRE tunnels, so you can
44 * have a NetBSD box as the other end of a tunnel interface of a Cisco
45 * router. See gre(4) for more details.
46 * Also supported: IP in IP encaps (proto 55) as of RFC 2004
47 */
48
49#include "opt_atalk.h"
50#include "opt_inet.h"
51#include "opt_inet6.h"
52
53#include <sys/param.h>
54#include <sys/kernel.h>
55#include <sys/malloc.h>
56#include <sys/mbuf.h>
57#include <sys/protosw.h>
58#include <sys/socket.h>
59#include <sys/sockio.h>
--- 521 unchanged lines hidden (view full) ---
581 si.sin_family = AF_INET;
582 si.sin_len = sizeof(struct sockaddr_in);
583 si.sin_addr.s_addr = sc->g_src.s_addr;
584 memcpy(&lifr->addr, &si, sizeof(si));
585 si.sin_addr.s_addr = sc->g_dst.s_addr;
586 memcpy(&lifr->dstaddr, &si, sizeof(si));
587 break;
588 case SIOCGIFPSRCADDR:
589#ifdef INET6
590 case SIOCGIFPSRCADDR_IN6:
591#endif
592 if (sc->g_src.s_addr == INADDR_ANY) {
593 error = EADDRNOTAVAIL;
594 break;
595 }
596 memset(&si, 0, sizeof(si));
597 si.sin_family = AF_INET;
598 si.sin_len = sizeof(struct sockaddr_in);
599 si.sin_addr.s_addr = sc->g_src.s_addr;
600 bcopy(&si, &ifr->ifr_addr, sizeof(ifr->ifr_addr));
601 break;
602 case SIOCGIFPDSTADDR:
603#ifdef INET6
604 case SIOCGIFPDSTADDR_IN6:
605#endif
606 if (sc->g_dst.s_addr == INADDR_ANY) {
607 error = EADDRNOTAVAIL;
608 break;
609 }
610 memset(&si, 0, sizeof(si));
611 si.sin_family = AF_INET;
612 si.sin_len = sizeof(struct sockaddr_in);
613 si.sin_addr.s_addr = sc->g_dst.s_addr;
--- 143 unchanged lines hidden ---