Deleted Added
full compact
ether.c (99086) ether.c (132818)
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 99086 2002-06-29 18:49:08Z brian $
26 * $FreeBSD: head/usr.sbin/ppp/ether.c 132818 2004-07-29 05:59:43Z glebius $
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>

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

438struct device *
439ether_Create(struct physical *p)
440{
441 u_char rbuf[2048];
442 struct etherdevice *dev;
443 struct ng_mesg *resp;
444 const struct hooklist *hlist;
445 const struct nodeinfo *ninfo;
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>

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

438struct device *
439ether_Create(struct physical *p)
440{
441 u_char rbuf[2048];
442 struct etherdevice *dev;
443 struct ng_mesg *resp;
444 const struct hooklist *hlist;
445 const struct nodeinfo *ninfo;
446 char *path, *sessionid;
446 char *path, *sessionid, *mode;
447 int ifacelen, f;
448
449 dev = NULL;
450 path = NULL;
451 ifacelen = 0;
452 if (p->fd < 0 && !strncasecmp(p->name.full, NG_PPPOE_NODE_TYPE,
453 PPPOE_NODE_TYPE_LEN) &&
454 p->name.full[PPPOE_NODE_TYPE_LEN] == ':') {

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

616 }
617
618 /* Bring the Ethernet interface up */
619 path[ifacelen] = '\0'; /* Remove the trailing ':' */
620 if (!iface_SetFlags(path, IFF_UP))
621 log_Printf(LogWARN, "%s: Failed to set the IFF_UP flag on %s\n",
622 p->link.name, path);
623
447 int ifacelen, f;
448
449 dev = NULL;
450 path = NULL;
451 ifacelen = 0;
452 if (p->fd < 0 && !strncasecmp(p->name.full, NG_PPPOE_NODE_TYPE,
453 PPPOE_NODE_TYPE_LEN) &&
454 p->name.full[PPPOE_NODE_TYPE_LEN] == ':') {

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

616 }
617
618 /* Bring the Ethernet interface up */
619 path[ifacelen] = '\0'; /* Remove the trailing ':' */
620 if (!iface_SetFlags(path, IFF_UP))
621 log_Printf(LogWARN, "%s: Failed to set the IFF_UP flag on %s\n",
622 p->link.name, path);
623
624 snprintf(connectpath, sizeof connectpath, ".:%s", dev->hook);
625
626 /* Configure node to 3Com mode if needed */
627 if (p->cfg.pppoe_configured) {
628 mode = p->cfg.nonstandard_pppoe ? NG_PPPOE_NONSTANDARD : NG_PPPOE_STANDARD;
629 if (NgSendMsg(dev->cs, connectpath, NGM_PPPOE_COOKIE,
630 NGM_PPPOE_SETMODE, mode, strlen(mode) + 1) == -1) {
631 log_Printf(LogWARN, "``%s'': Cannot configure netgraph node: %s\n",
632 connectpath, strerror(errno));
633 return ether_Abandon(dev, p);
634 }
635 }
636
624 /* And finally, request a connection to the given provider */
625
626 data = (struct ngpppoe_init_data *)alloca(sizeof *data + providerlen);
627 snprintf(data->hook, sizeof data->hook, "%s", dev->hook);
628 memcpy(data->data, provider, providerlen);
629 data->data_len = providerlen;
630
637 /* And finally, request a connection to the given provider */
638
639 data = (struct ngpppoe_init_data *)alloca(sizeof *data + providerlen);
640 snprintf(data->hook, sizeof data->hook, "%s", dev->hook);
641 memcpy(data->data, provider, providerlen);
642 data->data_len = providerlen;
643
631 snprintf(connectpath, sizeof connectpath, ".:%s", dev->hook);
632 log_Printf(LogDEBUG, "Sending PPPOE_CONNECT to %s\n", connectpath);
633 if (NgSendMsg(dev->cs, connectpath, NGM_PPPOE_COOKIE,
634 NGM_PPPOE_CONNECT, data, sizeof *data + providerlen) == -1) {
635 log_Printf(LogWARN, "``%s'': Cannot start netgraph node: %s\n",
636 connectpath, strerror(errno));
637 return ether_Abandon(dev, p);
638 }
639

--- 83 unchanged lines hidden ---
644 log_Printf(LogDEBUG, "Sending PPPOE_CONNECT to %s\n", connectpath);
645 if (NgSendMsg(dev->cs, connectpath, NGM_PPPOE_COOKIE,
646 NGM_PPPOE_CONNECT, data, sizeof *data + providerlen) == -1) {
647 log_Printf(LogWARN, "``%s'': Cannot start netgraph node: %s\n",
648 connectpath, strerror(errno));
649 return ether_Abandon(dev, p);
650 }
651

--- 83 unchanged lines hidden ---