ng_ppp.c (68876) | ng_ppp.c (69922) |
---|---|
1 2/* 3 * ng_ppp.c 4 * 5 * Copyright (c) 1996-2000 Whistle Communications, Inc. 6 * All rights reserved. 7 * 8 * Subject to the following obligations and disclaimer of warranty, use and --- 22 unchanged lines hidden (view full) --- 31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 35 * OF SUCH DAMAGE. 36 * 37 * Author: Archie Cobbs <archie@freebsd.org> 38 * | 1 2/* 3 * ng_ppp.c 4 * 5 * Copyright (c) 1996-2000 Whistle Communications, Inc. 6 * All rights reserved. 7 * 8 * Subject to the following obligations and disclaimer of warranty, use and --- 22 unchanged lines hidden (view full) --- 31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 35 * OF SUCH DAMAGE. 36 * 37 * Author: Archie Cobbs <archie@freebsd.org> 38 * |
39 * $FreeBSD: head/sys/netgraph/ng_ppp.c 68876 2000-11-18 15:17:43Z dwmalone $ | 39 * $FreeBSD: head/sys/netgraph/ng_ppp.c 69922 2000-12-12 18:52:14Z julian $ |
40 * $Whistle: ng_ppp.c,v 1.24 1999/11/01 09:24:52 julian Exp $ 41 */ 42 43/* 44 * PPP node type. 45 */ 46 47#include <sys/param.h> --- 299 unchanged lines hidden (view full) --- 347 NULL, 348 ng_ppp_constructor, 349 ng_ppp_rcvmsg, 350 ng_ppp_rmnode, 351 ng_ppp_newhook, 352 NULL, 353 NULL, 354 ng_ppp_rcvdata, | 40 * $Whistle: ng_ppp.c,v 1.24 1999/11/01 09:24:52 julian Exp $ 41 */ 42 43/* 44 * PPP node type. 45 */ 46 47#include <sys/param.h> --- 299 unchanged lines hidden (view full) --- 347 NULL, 348 ng_ppp_constructor, 349 ng_ppp_rcvmsg, 350 ng_ppp_rmnode, 351 ng_ppp_newhook, 352 NULL, 353 NULL, 354 ng_ppp_rcvdata, |
355 ng_ppp_rcvdata, | |
356 ng_ppp_disconnect, 357 ng_ppp_cmds 358}; 359NETGRAPH_INIT(ppp, &ng_ppp_typestruct); 360 361static int *compareLatencies; /* hack for ng_ppp_intcmp() */ 362 363/* Address and control field header */ --- 190 unchanged lines hidden (view full) --- 554 break; 555 } 556 break; 557 case NGM_VJC_COOKIE: 558 { 559 char path[NG_PATHLEN + 1]; 560 node_p origNode; 561 | 355 ng_ppp_disconnect, 356 ng_ppp_cmds 357}; 358NETGRAPH_INIT(ppp, &ng_ppp_typestruct); 359 360static int *compareLatencies; /* hack for ng_ppp_intcmp() */ 361 362/* Address and control field header */ --- 190 unchanged lines hidden (view full) --- 553 break; 554 } 555 break; 556 case NGM_VJC_COOKIE: 557 { 558 char path[NG_PATHLEN + 1]; 559 node_p origNode; 560 |
562 if ((error = ng_path2node(node, 563 raddr, &origNode, NULL, NULL)) != 0) | 561 if ((error = ng_path2node(node, raddr, &origNode, NULL)) != 0) |
564 ERROUT(error); 565 snprintf(path, sizeof(path), "[%lx]:%s", 566 (long)node, NG_PPP_HOOK_VJC_IP); | 562 ERROUT(error); 563 snprintf(path, sizeof(path), "[%lx]:%s", 564 (long)node, NG_PPP_HOOK_VJC_IP); |
567 return ng_send_msg(origNode, msg, path, rptr); | 565 return ng_send_msg(origNode, msg, path, NULL, NULL, rptr); 566/* XXX Archie, looks like you are using the wrong value for the ID here.. 567 you can't use a node address as a node-ID any more.. 568But it may be that you can use the new 'hook' arg for ng_send_msg() 569to achieve a more efficient resuld than an ID anyhow. */ |
568 } 569 default: 570 error = EINVAL; 571 break; 572 } 573 if (rptr) 574 *rptr = resp; 575 else if (resp) --- 4 unchanged lines hidden (view full) --- 580 return (error); 581} 582 583/* 584 * Receive data on a hook 585 */ 586static int 587ng_ppp_rcvdata(hook_p hook, struct mbuf *m, meta_p meta, | 570 } 571 default: 572 error = EINVAL; 573 break; 574 } 575 if (rptr) 576 *rptr = resp; 577 else if (resp) --- 4 unchanged lines hidden (view full) --- 582 return (error); 583} 584 585/* 586 * Receive data on a hook 587 */ 588static int 589ng_ppp_rcvdata(hook_p hook, struct mbuf *m, meta_p meta, |
588 struct mbuf **ret_m, meta_p *ret_meta) | 590 struct mbuf **ret_m, meta_p *ret_meta, struct ng_mesg **resp) |
589{ 590 const node_p node = hook->node; 591 const priv_p priv = node->private; 592 const int index = HOOK_INDEX(hook); 593 u_int16_t linkNum = NG_PPP_BUNDLE_LINKNUM; 594 hook_p outHook = NULL; 595 int proto = 0, error; 596 --- 179 unchanged lines hidden (view full) --- 776 return ng_ppp_input(node, 0, NG_PPP_BUNDLE_LINKNUM, m, meta); 777 778 case HOOK_INDEX_VJC_IP: 779 outHook = priv->hooks[HOOK_INDEX_INET]; 780 break; 781 } 782 783 /* Send packet out hook */ | 591{ 592 const node_p node = hook->node; 593 const priv_p priv = node->private; 594 const int index = HOOK_INDEX(hook); 595 u_int16_t linkNum = NG_PPP_BUNDLE_LINKNUM; 596 hook_p outHook = NULL; 597 int proto = 0, error; 598 --- 179 unchanged lines hidden (view full) --- 778 return ng_ppp_input(node, 0, NG_PPP_BUNDLE_LINKNUM, m, meta); 779 780 case HOOK_INDEX_VJC_IP: 781 outHook = priv->hooks[HOOK_INDEX_INET]; 782 break; 783 } 784 785 /* Send packet out hook */ |
784 NG_SEND_DATA_RET(error, outHook, m, meta); | 786 NG_SEND_DATA_RET(error, outHook, m, meta, resp); |
785 if (m != NULL || meta != NULL) | 787 if (m != NULL || meta != NULL) |
786 return ng_ppp_rcvdata(outHook, m, meta, NULL, NULL); | 788 return ng_ppp_rcvdata(outHook, m, meta, NULL, NULL, resp); |
787 return (error); 788} 789 790/* 791 * Destroy node 792 */ 793static int 794ng_ppp_rmnode(node_p node) --- 1241 unchanged lines hidden --- | 789 return (error); 790} 791 792/* 793 * Destroy node 794 */ 795static int 796ng_ppp_rmnode(node_p node) --- 1241 unchanged lines hidden --- |