summaryrefslogtreecommitdiffstats
path: root/src/core/pinger.c
diff options
context:
space:
mode:
authorMichael Brown2014-10-23 17:52:08 +0200
committerMichael Brown2014-10-23 17:52:08 +0200
commitdea6a6c1a07462890dc8bed4d048febdd13a2a3a (patch)
tree9bee6d8e8215e0c73ea4a5f4f38b77a8c0bf5d74 /src/core/pinger.c
parent[ping] Allow termination after a specified number of packets (diff)
downloadipxe-dea6a6c1a07462890dc8bed4d048febdd13a2a3a.tar.gz
ipxe-dea6a6c1a07462890dc8bed4d048febdd13a2a3a.tar.xz
ipxe-dea6a6c1a07462890dc8bed4d048febdd13a2a3a.zip
[ping] Allow "ping" command output to be inhibited
Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/pinger.c')
-rw-r--r--src/core/pinger.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/pinger.c b/src/core/pinger.c
index 558cfb49..31ea2ce1 100644
--- a/src/core/pinger.c
+++ b/src/core/pinger.c
@@ -166,7 +166,7 @@ static void pinger_expired ( struct retry_timer *timer, int over __unused ) {
int rc;
/* If no response has been received, notify the callback function */
- if ( pinger->pending )
+ if ( pinger->pending && pinger->callback )
pinger->callback ( NULL, pinger->sequence, 0, -ETIMEDOUT );
/* Check for termination */
@@ -263,8 +263,9 @@ static int pinger_deliver ( struct pinger *pinger, struct io_buffer *iobuf,
/* Discard I/O buffer */
free_iob ( iobuf );
- /* Notify callback function */
- pinger->callback ( meta->src, sequence, len, rc );
+ /* Notify callback function, if applicable */
+ if ( pinger->callback )
+ pinger->callback ( meta->src, sequence, len, rc );
/* Terminate if applicable */
if ( terminate )
@@ -301,6 +302,7 @@ static struct interface_descriptor pinger_job_desc =
* @v timeout Timeout (in ticks)
* @v len Payload length
* @v count Number of packets to send (or zero for no limit)
+ * @v callback Callback function (or NULL)
* @ret rc Return status code
*/
int create_pinger ( struct interface *job, const char *hostname,