diff options
author | brian <brian@FreeBSD.org> | 2002-02-20 15:51:11 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2002-02-20 15:51:11 +0000 |
commit | c53e73d628ce85e58c9e9036af405ce5349880a3 (patch) | |
tree | 4a515e4fe646b0327f06d6c4b11ef6dc67692b18 /sys/netgraph | |
parent | ad827f33f7f88bfb8412c89adcc8a18907121f43 (diff) | |
download | FreeBSD-src-c53e73d628ce85e58c9e9036af405ce5349880a3.zip FreeBSD-src-c53e73d628ce85e58c9e9036af405ce5349880a3.tar.gz |
Send a NGM_PPPOE_ACNAME message to userland when a node is connected.
Submitted by: Andre Albsmeier <andre@albsmeier.net>
Shuffled about by: brian
Approved by: julian
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/ng_pppoe.c | 24 | ||||
-rw-r--r-- | sys/netgraph/ng_pppoe.h | 3 |
2 files changed, 25 insertions, 2 deletions
diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c index 0a1e1b9..65aa93f 100644 --- a/sys/netgraph/ng_pppoe.c +++ b/sys/netgraph/ng_pppoe.c @@ -888,6 +888,26 @@ AAA sendpacket(sp); } +static int +send_acname(sessp sp, struct pppoe_tag *tag) +{ + int error; + struct ng_mesg *msg; + struct ngpppoe_sts *sts; + + NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, NGM_PPPOE_ACNAME, + sizeof(struct ngpppoe_sts), M_NOWAIT); + if (msg == NULL) + return (ENOMEM); + + sts = (struct ngpppoe_sts *)msg->data; + strncpy(sts->hook, tag->tag_data, + min(NG_HOOKLEN + 1, ntohs(tag->tag_len))); + NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, NULL); + + return (error); +} + /* * Receive data, and do something with it. * The caller will never free m or meta, so @@ -1063,8 +1083,10 @@ AAA insert_tag(sp, utag); /* Host Unique */ if ((tag = get_tag(ph, PTT_AC_COOKIE))) insert_tag(sp, tag); /* return cookie */ - if ((tag = get_tag(ph, PTT_AC_NAME))) + if ((tag = get_tag(ph, PTT_AC_NAME))) { insert_tag(sp, tag); /* return it */ + send_acname(sp, tag); + } insert_tag(sp, &neg->service.hdr); /* Service */ scan_tags(sp, ph); make_packet(sp); diff --git a/sys/netgraph/ng_pppoe.h b/sys/netgraph/ng_pppoe.h index b841d85..826d4b0 100644 --- a/sys/netgraph/ng_pppoe.h +++ b/sys/netgraph/ng_pppoe.h @@ -64,7 +64,7 @@ /********************************************************************** * Netgraph commands understood by this node type. - * FAIL, SUCCESS and CLOSE are sent by the node rather than received. + * FAIL, SUCCESS, CLOSE and ACNAME are sent by the node rather than received. ********************************************************************/ enum cmd { NGM_PPPOE_SET_FLAG = 1, @@ -75,6 +75,7 @@ enum cmd { NGM_PPPOE_FAIL = 6, /* State machine could not connect */ NGM_PPPOE_CLOSE = 7, /* Session closed down */ NGM_PPPOE_SERVICE = 8, /* additional Service to advertise (in PADO) */ + NGM_PPPOE_ACNAME = 9, /* AC_NAME for informational purposes */ NGM_PPPOE_GET_STATUS }; |