Provide a method to send a management error status message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
f233528ea4
commit
21c2fe30c7
32
port.c
32
port.c
|
@ -1390,6 +1390,38 @@ int port_manage(struct port *p, struct port *ingress, struct ptp_message *msg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int port_managment_error(struct PortIdentity pid, struct port *ingress,
|
||||||
|
struct ptp_message *req, Enumeration16 error_id)
|
||||||
|
{
|
||||||
|
struct ptp_message *msg;
|
||||||
|
struct management_tlv *mgt;
|
||||||
|
struct management_error_status *mes;
|
||||||
|
int err = 0, pdulen;
|
||||||
|
|
||||||
|
msg = port_management_reply(pid, ingress, req);
|
||||||
|
if (!msg) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
mgt = (struct management_tlv *) req->management.suffix;
|
||||||
|
mes = (struct management_error_status *) msg->management.suffix;
|
||||||
|
mes->type = TLV_MANAGEMENT_ERROR_STATUS;
|
||||||
|
mes->length = 8;
|
||||||
|
mes->error = error_id;
|
||||||
|
mes->id = mgt->id;
|
||||||
|
pdulen = msg->header.messageLength + sizeof(*mes);
|
||||||
|
msg->header.messageLength = pdulen;
|
||||||
|
msg->tlv_count = 1;
|
||||||
|
|
||||||
|
err = msg_pre_send(msg);
|
||||||
|
if (err) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
err = port_forward(ingress, msg, pdulen);
|
||||||
|
out:
|
||||||
|
msg_put(msg);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
struct ptp_message *port_management_reply(struct PortIdentity pid,
|
struct ptp_message *port_management_reply(struct PortIdentity pid,
|
||||||
struct port *ingress,
|
struct port *ingress,
|
||||||
struct ptp_message *req)
|
struct ptp_message *req)
|
||||||
|
|
11
port.h
11
port.h
|
@ -97,6 +97,17 @@ int port_forward(struct port *p, struct ptp_message *msg, int msglen);
|
||||||
*/
|
*/
|
||||||
int port_manage(struct port *p, struct port *ingress, struct ptp_message *msg);
|
int port_manage(struct port *p, struct port *ingress, struct ptp_message *msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a management error status message.
|
||||||
|
* @param pid The id of the responding port.
|
||||||
|
* @param ingress Port on which the 'req' was received.
|
||||||
|
* @param req The management message which triggered the error.
|
||||||
|
* @param error_id One of the management error ID values.
|
||||||
|
* @return Zero on success, non-zero otherwise.
|
||||||
|
*/
|
||||||
|
int port_managment_error(struct PortIdentity pid, struct port *ingress,
|
||||||
|
struct ptp_message *req, Enumeration16 error_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a reply to a management message.
|
* Allocate a reply to a management message.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue