version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.2, 2013/07/22 08:44:29
|
Line 13
|
Line 13
|
#include "log.h" |
#include "log.h" |
#include "util.h" |
#include "util.h" |
|
|
|
#include <paths.h> |
#include <net/ethernet.h> |
#include <net/ethernet.h> |
#include <netgraph/ng_message.h> |
#include <netgraph/ng_message.h> |
#include <netgraph/ng_pppoe.h> |
#include <netgraph/ng_pppoe.h> |
Line 34
|
Line 35
|
|
|
#define ETHER_DEFAULT_HOOK NG_ETHER_HOOK_ORPHAN |
#define ETHER_DEFAULT_HOOK NG_ETHER_HOOK_ORPHAN |
|
|
|
#ifndef SMALL_SYSTEM |
#define PPPOE_MAXPARENTIFS 1024 |
#define PPPOE_MAXPARENTIFS 1024 |
|
#else |
|
#define PPPOE_MAXPARENTIFS 32 |
|
#endif |
|
|
#define MAX_PATH 64 /* XXX should be NG_PATHSIZ */ |
#define MAX_PATH 64 /* XXX should be NG_PATHSIZ */ |
#define MAX_SESSION 64 /* max length of PPPoE session name */ |
#define MAX_SESSION 64 /* max length of PPPoE session name */ |
Line 587 PppoePeerMacAddr(Link l, void *buf, size_t buf_len)
|
Line 592 PppoePeerMacAddr(Link l, void *buf, size_t buf_len)
|
{ |
{ |
PppoeInfo const pppoe = (PppoeInfo)l->info; |
PppoeInfo const pppoe = (PppoeInfo)l->info; |
|
|
snprintf(buf, buf_len, "%02x:%02x:%02x:%02x:%02x:%02x", | ether_ntoa_r((struct ether_addr *)pppoe->peeraddr, buf); |
pppoe->peeraddr[0], pppoe->peeraddr[1], pppoe->peeraddr[2], | |
pppoe->peeraddr[3], pppoe->peeraddr[4], pppoe->peeraddr[5]); | |
| |
return (0); |
return (0); |
} |
} |
|
|
Line 613 PppoeCallingNum(Link l, void *buf, size_t buf_len)
|
Line 615 PppoeCallingNum(Link l, void *buf, size_t buf_len)
|
PppoeInfo const pppoe = (PppoeInfo)l->info; |
PppoeInfo const pppoe = (PppoeInfo)l->info; |
|
|
if (pppoe->incoming) { |
if (pppoe->incoming) { |
snprintf(buf, buf_len, "%02x%02x%02x%02x%02x%02x", | ether_ntoa_r((struct ether_addr *)pppoe->peeraddr, buf); |
pppoe->peeraddr[0], pppoe->peeraddr[1], pppoe->peeraddr[2], | |
pppoe->peeraddr[3], pppoe->peeraddr[4], pppoe->peeraddr[5]); | |
} else { |
} else { |
strlcpy(buf, pppoe->real_session, buf_len); |
strlcpy(buf, pppoe->real_session, buf_len); |
} |
} |
Line 629 PppoeCalledNum(Link l, void *buf, size_t buf_len)
|
Line 629 PppoeCalledNum(Link l, void *buf, size_t buf_len)
|
PppoeInfo const pppoe = (PppoeInfo)l->info; |
PppoeInfo const pppoe = (PppoeInfo)l->info; |
|
|
if (!pppoe->incoming) { |
if (!pppoe->incoming) { |
snprintf(buf, buf_len, "%02x%02x%02x%02x%02x%02x", | ether_ntoa_r((struct ether_addr *)pppoe->peeraddr, buf); |
pppoe->peeraddr[0], pppoe->peeraddr[1], pppoe->peeraddr[2], | |
pppoe->peeraddr[3], pppoe->peeraddr[4], pppoe->peeraddr[5]); | |
} else { |
} else { |
strlcpy(buf, pppoe->real_session, buf_len); |
strlcpy(buf, pppoe->real_session, buf_len); |
} |
} |
Line 677 CreatePppoeNode(struct PppoeIf *PIf, const char *path,
|
Line 675 CreatePppoeNode(struct PppoeIf *PIf, const char *path,
|
strlcpy(iface, path, sizeof(iface)); |
strlcpy(iface, path, sizeof(iface)); |
if (iface[strlen(iface) - 1] == ':') |
if (iface[strlen(iface) - 1] == ':') |
iface[strlen(iface) - 1] = '\0'; |
iface[strlen(iface) - 1] = '\0'; |
if (ExecCmdNosh(LG_PHYS2, iface, "%s %s up", PATH_IFCONFIG, iface) != 0) { | if (ExecCmdNosh(LG_PHYS2, iface, "%s %s up", _PATH_IFCONFIG, iface) != 0) { |
Log(LG_ERR, ("PPPoE: can't bring up interface %s", |
Log(LG_ERR, ("PPPoE: can't bring up interface %s", |
iface)); |
iface)); |
return (0); |
return (0); |