summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_pppoe.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2002-02-20 15:51:11 +0000
committerbrian <brian@FreeBSD.org>2002-02-20 15:51:11 +0000
commitc53e73d628ce85e58c9e9036af405ce5349880a3 (patch)
tree4a515e4fe646b0327f06d6c4b11ef6dc67692b18 /sys/netgraph/ng_pppoe.c
parentad827f33f7f88bfb8412c89adcc8a18907121f43 (diff)
downloadFreeBSD-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/ng_pppoe.c')
-rw-r--r--sys/netgraph/ng_pppoe.c24
1 files changed, 23 insertions, 1 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);
OpenPOWER on IntegriCloud