Raise a bus alert when IKE message header parsing fails
authorMartin Willi <martin@revosec.ch>
Mon, 8 Oct 2012 09:15:09 +0000 (11:15 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 24 Oct 2012 09:34:30 +0000 (11:34 +0200)
src/libcharon/bus/bus.h
src/libcharon/network/receiver.c

index c732b8c..2cd04cf 100644 (file)
@@ -94,6 +94,8 @@ enum alert_t {
        ALERT_PEER_INIT_UNREACHABLE,
        /** received IKE message with invalid SPI, argument is message_t* */
        ALERT_INVALID_IKE_SPI,
+       /** received IKE message with invalid header, argument is message_t* */
+       ALERT_PARSE_ERROR_HEADER,
 };
 
 /**
index 2f87a5e..205bee5 100644 (file)
@@ -488,6 +488,7 @@ static job_requeue_t receive_packets(private_receiver_t *this)
        {
                DBG1(DBG_NET, "received invalid IKE header from %H - ignored",
                         packet->get_source(packet));
+               charon->bus->alert(charon->bus, ALERT_PARSE_ERROR_HEADER, message);
                message->destroy(message);
                return JOB_REQUEUE_DIRECT;
        }