ether.c (71006) | ether.c (74916) |
---|---|
1/*- 2 * Copyright (c) 1999 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) 1999 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/ether.c 71006 2001-01-14 00:54:48Z brian $ | 26 * $FreeBSD: head/usr.sbin/ppp/ether.c 74916 2001-03-28 09:45:27Z brian $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <sys/un.h> 32#include <netinet/in.h> 33#include <arpa/inet.h> 34#include <netdb.h> 35#include <netgraph.h> 36#include <net/ethernet.h> | 27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <sys/un.h> 32#include <netinet/in.h> 33#include <arpa/inet.h> 34#include <netdb.h> 35#include <netgraph.h> 36#include <net/ethernet.h> |
37#include <net/if.h> 38#include <net/route.h> |
|
37#include <netinet/in_systm.h> 38#include <netinet/ip.h> 39#include <netgraph/ng_ether.h> 40#include <netgraph/ng_message.h> 41#include <netgraph/ng_pppoe.h> 42#include <netgraph/ng_socket.h> 43 44#include <errno.h> --- 38 unchanged lines hidden (view full) --- 83#include "iplist.h" 84#include "ipcp.h" 85#include "filter.h" 86#ifndef NORADIUS 87#include "radius.h" 88#endif 89#include "bundle.h" 90#include "id.h" | 39#include <netinet/in_systm.h> 40#include <netinet/ip.h> 41#include <netgraph/ng_ether.h> 42#include <netgraph/ng_message.h> 43#include <netgraph/ng_pppoe.h> 44#include <netgraph/ng_socket.h> 45 46#include <errno.h> --- 38 unchanged lines hidden (view full) --- 85#include "iplist.h" 86#include "ipcp.h" 87#include "filter.h" 88#ifndef NORADIUS 89#include "radius.h" 90#endif 91#include "bundle.h" 92#include "id.h" |
93#include "iface.h" |
|
91#include "ether.h" 92 93 94#define PPPOE_NODE_TYPE_LEN (sizeof NG_PPPOE_NODE_TYPE - 1) /* "PPPoE" */ 95 96struct etherdevice { 97 struct device dev; /* What struct physical knows about */ 98 int cs; /* Control socket */ --- 295 unchanged lines hidden (view full) --- 394struct device * 395ether_Create(struct physical *p) 396{ 397 u_char rbuf[2048]; 398 struct etherdevice *dev; 399 struct ng_mesg *resp; 400 const struct hooklist *hlist; 401 const struct nodeinfo *ninfo; | 94#include "ether.h" 95 96 97#define PPPOE_NODE_TYPE_LEN (sizeof NG_PPPOE_NODE_TYPE - 1) /* "PPPoE" */ 98 99struct etherdevice { 100 struct device dev; /* What struct physical knows about */ 101 int cs; /* Control socket */ --- 295 unchanged lines hidden (view full) --- 397struct device * 398ether_Create(struct physical *p) 399{ 400 u_char rbuf[2048]; 401 struct etherdevice *dev; 402 struct ng_mesg *resp; 403 const struct hooklist *hlist; 404 const struct nodeinfo *ninfo; |
402 int f; | 405 char *path; 406 int ifacelen, f; |
403 404 dev = NULL; | 407 408 dev = NULL; |
409 path = NULL; 410 ifacelen = 0; |
|
405 if (p->fd < 0 && !strncasecmp(p->name.full, NG_PPPOE_NODE_TYPE, 406 PPPOE_NODE_TYPE_LEN) && 407 p->name.full[PPPOE_NODE_TYPE_LEN] == ':') { 408 const struct linkinfo *nlink; 409 struct ngpppoe_init_data *data; 410 struct ngm_mkpeer mkp; 411 struct ngm_connect ngc; 412 const char *iface, *provider; | 411 if (p->fd < 0 && !strncasecmp(p->name.full, NG_PPPOE_NODE_TYPE, 412 PPPOE_NODE_TYPE_LEN) && 413 p->name.full[PPPOE_NODE_TYPE_LEN] == ':') { 414 const struct linkinfo *nlink; 415 struct ngpppoe_init_data *data; 416 struct ngm_mkpeer mkp; 417 struct ngm_connect ngc; 418 const char *iface, *provider; |
413 char *path, etherid[12]; 414 int ifacelen, providerlen; | 419 char etherid[12]; 420 int providerlen; |
415 char connectpath[sizeof dev->hook + 2]; /* .:<hook> */ 416 417 p->fd--; /* We own the device - change fd */ 418 419#if defined(__FreeBSD__) && !defined(NOKLDLOAD) 420 if (modfind("netgraph") == -1) { 421 log_Printf(LogWARN, "Netgraph is not built into the kernel\n"); 422 return NULL; --- 246 unchanged lines hidden (view full) --- 669 log_Printf(LogWARN, "%s: Reducing MRU to 1492\n", p->link.name); 670 p->link.lcp.cfg.mru = 1492; 671 } 672 if (p->dl->bundle->cfg.mtu > 1492) { 673 log_Printf(LogWARN, "%s: Reducing MTU to 1492\n", p->link.name); 674 p->dl->bundle->cfg.mtu = 1492; 675 } 676 | 421 char connectpath[sizeof dev->hook + 2]; /* .:<hook> */ 422 423 p->fd--; /* We own the device - change fd */ 424 425#if defined(__FreeBSD__) && !defined(NOKLDLOAD) 426 if (modfind("netgraph") == -1) { 427 log_Printf(LogWARN, "Netgraph is not built into the kernel\n"); 428 return NULL; --- 246 unchanged lines hidden (view full) --- 675 log_Printf(LogWARN, "%s: Reducing MRU to 1492\n", p->link.name); 676 p->link.lcp.cfg.mru = 1492; 677 } 678 if (p->dl->bundle->cfg.mtu > 1492) { 679 log_Printf(LogWARN, "%s: Reducing MTU to 1492\n", p->link.name); 680 p->dl->bundle->cfg.mtu = 1492; 681 } 682 |
683 if (path != NULL) { 684 /* Mark the interface as UP if it's not already */ 685 686 path[ifacelen] = '\0'; /* Remove the trailing ':' */ 687 if (!iface_SetFlags(path, IFF_UP)) 688 log_Printf(LogWARN, "%s: Failed to set the IFF_UP flag on %s\n", 689 p->link.name, path); 690 } 691 |
|
677 return &dev->dev; 678 } 679 680 return NULL; 681} | 692 return &dev->dev; 693 } 694 695 return NULL; 696} |