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
This commit is contained in:
Brian Somers 2002-02-20 15:51:11 +00:00
parent 15b27e726e
commit c48a0b5fb4
2 changed files with 25 additions and 2 deletions

View File

@ -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);

View File

@ -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
};