1/* $NetBSD: if_gre.c,v 1.42 2002/08/14 00:23:27 itojun Exp $ */
2/* $FreeBSD: head/sys/net/if_gre.c 121816 2003-10-31 18:32:15Z brooks $ */
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
52#include <sys/param.h>
53#include <sys/kernel.h>
54#include <sys/malloc.h>
55#include <sys/mbuf.h>
56#include <sys/protosw.h>
57#include <sys/socket.h>
58#include <sys/sockio.h>
--- 521 unchanged lines hidden (view full) ---
580 si.sin_family = AF_INET;
581 si.sin_len = sizeof(struct sockaddr_in);
582 si.sin_addr.s_addr = sc->g_src.s_addr;
583 memcpy(&lifr->addr, &si, sizeof(si));
584 si.sin_addr.s_addr = sc->g_dst.s_addr;
585 memcpy(&lifr->dstaddr, &si, sizeof(si));
586 break;
587 case SIOCGIFPSRCADDR:
588 if (sc->g_src.s_addr == INADDR_ANY) {
589 error = EADDRNOTAVAIL;
590 break;
591 }
592 memset(&si, 0, sizeof(si));
593 si.sin_family = AF_INET;
594 si.sin_len = sizeof(struct sockaddr_in);
595 si.sin_addr.s_addr = sc->g_src.s_addr;
596 bcopy(&si, &ifr->ifr_addr, sizeof(ifr->ifr_addr));
597 break;
598 case SIOCGIFPDSTADDR:
599 if (sc->g_dst.s_addr == INADDR_ANY) {
600 error = EADDRNOTAVAIL;
601 break;
602 }
603 memset(&si, 0, sizeof(si));
604 si.sin_family = AF_INET;
605 si.sin_len = sizeof(struct sockaddr_in);
606 si.sin_addr.s_addr = sc->g_dst.s_addr;
--- 143 unchanged lines hidden ---
2/* $FreeBSD: head/sys/net/if_gre.c 121816 2003-10-31 18:32:15Z brooks $ */
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
52#include <sys/param.h>
53#include <sys/kernel.h>
54#include <sys/malloc.h>
55#include <sys/mbuf.h>
56#include <sys/protosw.h>
57#include <sys/socket.h>
58#include <sys/sockio.h>
--- 521 unchanged lines hidden (view full) ---
580 si.sin_family = AF_INET;
581 si.sin_len = sizeof(struct sockaddr_in);
582 si.sin_addr.s_addr = sc->g_src.s_addr;
583 memcpy(&lifr->addr, &si, sizeof(si));
584 si.sin_addr.s_addr = sc->g_dst.s_addr;
585 memcpy(&lifr->dstaddr, &si, sizeof(si));
586 break;
587 case SIOCGIFPSRCADDR:
588 if (sc->g_src.s_addr == INADDR_ANY) {
589 error = EADDRNOTAVAIL;
590 break;
591 }
592 memset(&si, 0, sizeof(si));
593 si.sin_family = AF_INET;
594 si.sin_len = sizeof(struct sockaddr_in);
595 si.sin_addr.s_addr = sc->g_src.s_addr;
596 bcopy(&si, &ifr->ifr_addr, sizeof(ifr->ifr_addr));
597 break;
598 case SIOCGIFPDSTADDR:
599 if (sc->g_dst.s_addr == INADDR_ANY) {
600 error = EADDRNOTAVAIL;
601 break;
602 }
603 memset(&si, 0, sizeof(si));
604 si.sin_family = AF_INET;
605 si.sin_len = sizeof(struct sockaddr_in);
606 si.sin_addr.s_addr = sc->g_dst.s_addr;
--- 143 unchanged lines hidden ---