diff options
| -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 0a1e1b9ee077..65aa93fb57c4 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 b841d8504082..826d4b0a3b79 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 }; |
