FreeBSD Bugzilla – Attachment 28684 Details for
Bug 48138
mpd does not reuses netgraph pppoe nodes attached to ether node
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.94 KB, created by
Gleb Smirnoff
on 2003-02-10 12:50:08 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Gleb Smirnoff
Created:
2003-02-10 12:50:08 UTC
Size:
3.94 KB
patch
obsolete
>--- pppoe.c.orig Fri Jan 24 20:15:56 2003 >+++ pppoe.c Fri Jan 24 21:33:57 2003 >@@ -161,6 +161,12 @@ > struct ngpppoe_init_data *const idata = &u.poeid; > char path[NG_PATHLEN + 1]; > char linkHook[NG_HOOKLEN + 1]; >+ u_char rbuf[2048]; >+ struct ng_mesg *resp; >+ const struct hooklist *hlist; >+ const struct nodeinfo *ninfo; >+ const struct linkinfo *nlink; >+ int f; > > /* Sanity */ > if (pe->state != PPPOE_DOWN) >@@ -189,37 +195,93 @@ > } > (void)fcntl(pe->csock, F_SETFD, 1); > >-#if 0 /**** BUG IN NgSendAsciiMsg(), fixed in rev. 1.3 ****/ >- /* Attach a new ng_pppoe(4) node to the Ethernet node */ >- if (NgSendAsciiMsg(bund->csock, pe->path, >+ /* >+ * Ask for a list of hooks attached to the "ether" node. This node should >+ * magically exist as a way of hooking stuff onto an ethernet device >+ */ >+ if (NgSendMsg(bund->csock, pe->path, NGM_GENERIC_COOKIE, NGM_LISTHOOKS, >+ NULL, 0) < 0) { >+ Log(LG_ERR, ("[%s] Cannot send a netgraph message: %s:%s", >+ lnk->name, pe->path, strerror(errno))); >+ goto fail2; >+ } >+ >+ /* Get our list back */ >+ resp = (struct ng_mesg *)rbuf; >+ if (NgRecvMsg(bund->csock, resp, sizeof rbuf, NULL) <= 0) { >+ Log(LG_ERR, ("[%s] Cannot get netgraph response: %s", >+ lnk->name, strerror(errno))); >+ goto fail2; >+ } >+ >+ hlist = (const struct hooklist *)resp->data; >+ ninfo = &hlist->nodeinfo; >+ >+ /* Make sure we've got the right type of node */ >+ if (strncmp(ninfo->type, NG_ETHER_NODE_TYPE, >+ sizeof NG_ETHER_NODE_TYPE - 1)) { >+ Log(LG_ERR, ("[%s] Unexpected node type ``%s'' (wanted ``" NG_ETHER_NODE_TYPE "'') on %s", lnk->name, ninfo->type, pe->path)); >+ goto fail2; >+ } >+ >+ /* look for a hook already attached. */ >+ for (f = 0; f < ninfo->hooks; f++) { >+ nlink = &hlist->link[f]; >+ >+ if (!strcmp(nlink->ourhook, NG_ETHER_HOOK_ORPHAN) || >+ !strcmp(nlink->ourhook, NG_ETHER_HOOK_DIVERT)) { >+ /* >+ * Something is using the data coming out of this ``ether'' node. >+ * If it's a PPPoE node, we use that node, otherwise we complain that >+ * someone else is using the node. >+ */ >+ if (!strcmp(nlink->nodeinfo.type, NG_PPPOE_NODE_TYPE)) >+ /* Use this PPPoE node ! */ >+ snprintf(path, sizeof(path), "[%x]:", nlink->nodeinfo.id); >+ else { >+ Log(LG_ERR, ("%s Node type ``%s'' is currently active\n", >+ path, nlink->nodeinfo.type)); >+ goto fail2; >+ } >+ break; >+ } >+ } >+ >+ if (f == ninfo->hooks) { /* Create new PPP node */ >+ >+#if 0 /**** BUG IN NgSendAsciiMsg(), fixed in rev. 1.3 ****/ >+ /* Attach a new ng_pppoe(4) node to the Ethernet node */ >+ if (NgSendAsciiMsg(bund->csock, pe->path, > "mkpeer { type=\"%s\" ourhook=\"%s\" peerhook=\"%s\" }", > NG_PPPOE_NODE_TYPE, pe->hook, NG_PPPOE_HOOK_ETHERNET) < 0) { > Log(LG_ERR, ("[%s] can't create %s peer to %s,%s: %s", > lnk->name, NG_PPPOE_NODE_TYPE, > pe->path, pe->hook, strerror(errno))); > goto fail2; >- } >+ } > #else >- { >- struct ngm_mkpeer mp; >+ { >+ struct ngm_mkpeer mp; > >- /* Create new PPP node */ >- snprintf(mp.type, sizeof(mp.type), "%s", NG_PPPOE_NODE_TYPE); >- snprintf(mp.ourhook, sizeof(mp.ourhook), "%s", pe->hook); >- snprintf(mp.peerhook, sizeof(mp.peerhook), >+ snprintf(mp.type, sizeof(mp.type), "%s", NG_PPPOE_NODE_TYPE); >+ snprintf(mp.ourhook, sizeof(mp.ourhook), "%s", pe->hook); >+ snprintf(mp.peerhook, sizeof(mp.peerhook), > "%s", NG_PPPOE_HOOK_ETHERNET); >- if (NgSendMsg(bund->csock, pe->path, >+ if (NgSendMsg(bund->csock, pe->path, > NGM_GENERIC_COOKIE, NGM_MKPEER, &mp, sizeof(mp)) < 0) { > Log(LG_ERR, ("[%s] can't create %s peer to %s,%s: %s", > lnk->name, NG_PPPOE_NODE_TYPE, > pe->path, pe->hook, strerror(errno))); > goto fail2; >- } >- } >+ } >+ } > #endif > > /* Connect our ng_ppp(4) node link hook to the ng_pppoe(4) node */ > snprintf(path, sizeof(path), "%s%s", pe->path, pe->hook); >+ >+ } >+ > snprintf(linkHook, sizeof(linkHook), > "%s%d", NG_PPP_HOOK_LINK_PREFIX, lnk->bundleIndex); > if (NgFuncConnect(MPD_HOOK_PPP, linkHook, path, PPPOE_SESSION_HOOK) < 0)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 48138
: 28684