I am looking at the macros NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO and
NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO. Correct me if I am wrong I see
these macros getting the pointer from the ndis packet structure and
setting the pointer.
I am planning to create a new NDIS_PACKET and copy the necessary data
from the old to new packets and let the old packet go…(Something like
returning status success so that protocol would free the packet. I am
not planning to keep the packet with me as passthrough is doing.) In
this scenario wouldn’t the protocol or ndis free the media specific
info???
I see this working fine only if the media specific info is some static
data and this data is never freed by anyone. Is this pointing to some
static data?
I pasted the macros I was referring to here for your convenience.
-Srin.
#define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
_pMediaSpecificInfo,
\
_pSizeMediaSpecificInfo)
\
{
\
if (!((_Packet)->Private.NdisPacketFlags &
fPACKET_ALLOCATED_BY_NDIS) ||\
!((_Packet)->Private.NdisPacketFlags &
fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO))\
{
\
*(_pMediaSpecificInfo) = NULL;
\
*(_pSizeMediaSpecificInfo) = 0;
\
}
\
else
\
{
\
*(_pMediaSpecificInfo)
=((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +\
(_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation;\
*(_pSizeMediaSpecificInfo) =
((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +\
(_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo;\
}
\
}
#define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
_MediaSpecificInfo,
\
_SizeMediaSpecificInfo)
\
{
\
if ((_Packet)->Private.NdisPacketFlags &
fPACKET_ALLOCATED_BY_NDIS) \
{
\
(_Packet)->Private.NdisPacketFlags |=
fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO;\
((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +
\
(_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation =
(_MediaSpecificInfo);\
((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +
\
(_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo =
(_SizeMediaSpecificInfo);\
} \
}