diff options
author | Girish Moodalbail <Girish.Moodalbail@Sun.COM> | 2008-12-23 15:02:02 -0500 |
---|---|---|
committer | Girish Moodalbail <Girish.Moodalbail@Sun.COM> | 2008-12-23 15:02:02 -0500 |
commit | c623edd31cf7c582de6a3f26cc42c651d6002f73 (patch) | |
tree | 82e41039501070569a14e1366050023f85e8b10d /usr/src | |
parent | 19a8a986a692bc1fdeb3de480b5d435d2d13bede (diff) | |
download | illumos-joyent-c623edd31cf7c582de6a3f26cc42c651d6002f73.tar.gz |
6761558 DLPI notification support broke libdlpi API for raw sessions
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/lib/libdlpi/common/libdlpi.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/usr/src/lib/libdlpi/common/libdlpi.c b/usr/src/lib/libdlpi/common/libdlpi.c index c6049cb211..f53abef44e 100644 --- a/usr/src/lib/libdlpi/common/libdlpi.c +++ b/usr/src/lib/libdlpi/common/libdlpi.c @@ -1391,8 +1391,13 @@ i_dlpi_strgetmsg(dlpi_impl_t *dip, int msec, dlpi_msg_t *dlreplyp, dl_notify_ind_t *dlnotif; boolean_t infinite = (msec < 0); /* infinite timeout */ - if ((dlreplyp == NULL && databuf == NULL) || - (databuf == NULL && datalenp != NULL) || + /* + * dlreplyp and databuf can be NULL at the same time, to force a check + * for pending events on the DLPI link instance; dlpi_enabnotify(3DLPI). + * this will be true more so for DLPI_RAW mode with notifications + * enabled. + */ + if ((databuf == NULL && datalenp != NULL) || (databuf != NULL && datalenp == NULL)) return (DLPI_EINVAL); @@ -1478,13 +1483,14 @@ i_dlpi_strgetmsg(dlpi_impl_t *dip, int msec, dlpi_msg_t *dlreplyp, * requested message. */ if (dip->dli_notifylistp != NULL && - dlreplyp->dlm_msg->dl_primitive == DL_NOTIFY_IND) { - if (ctl.len < DL_NOTIFY_IND_SIZE) - continue; - dlnotif = &(dlreplyp->dlm_msg->notify_ind); - - (void) i_dlpi_notifyind_process(dip, dlnotif); - continue; + ctl.len >= (int)(sizeof (t_uscalar_t)) && + *(t_uscalar_t *)(void *)ctl.buf == DL_NOTIFY_IND) { + /* process properly-formed DL_NOTIFY_IND messages */ + if (ctl.len >= DL_NOTIFY_IND_SIZE) { + dlnotif = (dl_notify_ind_t *)(void *)ctl.buf; + (void) i_dlpi_notifyind_process(dip, dlnotif); + } + goto update_timer; } /* @@ -1521,7 +1527,7 @@ i_dlpi_strgetmsg(dlpi_impl_t *dip, int msec, dlpi_msg_t *dlreplyp, break; } } - +update_timer: if (!infinite) { current = gethrtime() / (NANOSEC / MILLISEC); msec -= (current - start); |