summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--daemons/gptp/common/common_port.cpp5
-rw-r--r--daemons/gptp/common/ether_port.cpp3
-rw-r--r--kmod/igb/igb_main.c22
-rw-r--r--lib/avtp_pipeline/endpoint/openavb_endpoint_server.c4
-rw-r--r--lib/avtp_pipeline/include/openavb_audio_pub.h16
-rwxr-xr-xlib/avtp_pipeline/map_aaf_audio/openavb_map_aaf_audio.c45
-rw-r--r--lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_cfg.c2
-rw-r--r--lib/avtp_pipeline/platform/Linux/endpoint/openavb_endpoint_cfg.c20
-rw-r--r--lib/avtp_pipeline/platform/Linux/rawsock/simple_rawsock.c2
-rw-r--r--lib/avtp_pipeline/platform/Linux/tl/openavb_tl_osal.c16
-rw-r--r--lib/avtp_pipeline/qmgr/openavb_qmgr.c16
-rw-r--r--lib/avtp_pipeline/tl/openavb_listener_endpoint.c18
-rw-r--r--lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c18
-rw-r--r--lib/avtp_pipeline/tl/openavb_talker_endpoint.c8
-rw-r--r--lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c3
-rwxr-xr-xlib/avtp_pipeline/tl/openavb_tl_pub.h6
16 files changed, 125 insertions, 79 deletions
diff --git a/daemons/gptp/common/common_port.cpp b/daemons/gptp/common/common_port.cpp
index 6e599e76..901f00fc 100644
--- a/daemons/gptp/common/common_port.cpp
+++ b/daemons/gptp/common/common_port.cpp
@@ -603,7 +603,7 @@ bool CommonPort::processEvent( Event e )
// If port has been configured as master or slave, run media
// specific configuration. If it hasn't been configured
- // start announce message time
+ // start listening for announce messages
if( clock->getPriority1() == 255 ||
port_state == PTP_SLAVE )
{
@@ -615,7 +615,8 @@ bool CommonPort::processEvent( Event e )
}
else
{
- startAnnounce();
+ clock->addEventTimerLocked(this, ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES,
+ ANNOUNCE_RECEIPT_TIMEOUT_MULTIPLIER * pow(2.0, getAnnounceInterval()) * 1000000000.0);
}
// Do any media specific initialization
diff --git a/daemons/gptp/common/ether_port.cpp b/daemons/gptp/common/ether_port.cpp
index 0a294fa2..094e46e6 100644
--- a/daemons/gptp/common/ether_port.cpp
+++ b/daemons/gptp/common/ether_port.cpp
@@ -579,7 +579,8 @@ bool EtherPort::_processEvent( Event e )
} else if( getPortState() == PTP_MASTER ) {
becomeMaster( true );
} else {
- startAnnounce();
+ clock->addEventTimerLocked(this, ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES,
+ ANNOUNCE_RECEIPT_TIMEOUT_MULTIPLIER * pow(2.0, getAnnounceInterval()) * 1000000000.0);
}
if (automotive_profile) {
diff --git a/kmod/igb/igb_main.c b/kmod/igb/igb_main.c
index 3310680d..c8a4a7e3 100644
--- a/kmod/igb/igb_main.c
+++ b/kmod/igb/igb_main.c
@@ -181,8 +181,14 @@ static void igb_restore_vf_multicasts(struct igb_adapter *adapter);
static void igb_process_mdd_event(struct igb_adapter *);
#ifdef IFLA_VF_MAX
static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
+#ifdef IFLA_VF_VLAN_INFO_MAX
+static int igb_ndo_set_vf_vlan(struct net_device *netdev,
+ int vf, u16 vlan, u8 qos, __be16 vlan_proto);
+#else
static int igb_ndo_set_vf_vlan(struct net_device *netdev,
int vf, u16 vlan, u8 qos);
+#endif /*IFLA_VF_VLAN_INFO_MAX*/
+
#ifdef HAVE_VF_SPOOFCHK_CONFIGURE
static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
bool setting);
@@ -6648,9 +6654,15 @@ static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf)
else
E1000_WRITE_REG(hw, E1000_VMVIR(vf), 0);
}
+#ifdef IFLA_VF_VLAN_INFO_MAX
+static int igb_ndo_set_vf_vlan(struct net_device *netdev,
+ int vf, u16 vlan, u8 qos, __be16 vlan_proto)
+#else
static int igb_ndo_set_vf_vlan(struct net_device *netdev,
- int vf, u16 vlan, u8 qos)
+ int vf, u16 vlan, u8 qos)
+#endif /*IFLA_VF_VLAN_INFO_MAX*/
+
{
int err = 0;
struct igb_adapter *adapter = netdev_priv(netdev);
@@ -6659,6 +6671,7 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
if ((vf >= adapter->vfs_allocated_count) || (vlan > VLAN_VID_MASK-1)
|| (qos > 7))
return -EINVAL;
+
if (vlan || qos) {
err = igb_vlvf_set(adapter, vlan, !!vlan, vf);
if (err)
@@ -6816,9 +6829,16 @@ static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf)
igb_clear_vf_vfta(adapter, vf);
#ifdef IFLA_VF_MAX
if (adapter->vf_data[vf].pf_vlan)
+#ifdef IFLA_VF_VLAN_INFO_MAX
+ igb_ndo_set_vf_vlan(adapter->netdev, vf,
+ adapter->vf_data[vf].pf_vlan,
+ adapter->vf_data[vf].pf_qos, 0);
+#else
+
igb_ndo_set_vf_vlan(adapter->netdev, vf,
adapter->vf_data[vf].pf_vlan,
adapter->vf_data[vf].pf_qos);
+#endif
else
igb_clear_vf_vfta(adapter, vf);
#endif
diff --git a/lib/avtp_pipeline/endpoint/openavb_endpoint_server.c b/lib/avtp_pipeline/endpoint/openavb_endpoint_server.c
index 22208333..005d30d7 100644
--- a/lib/avtp_pipeline/endpoint/openavb_endpoint_server.c
+++ b/lib/avtp_pipeline/endpoint/openavb_endpoint_server.c
@@ -138,7 +138,7 @@ void openavbEptSrvrNotifyTlkrOfSrpCb(int h,
memset(&msgBuf, 0, OPENAVB_ENDPOINT_MSG_LEN);
msgBuf.type = OPENAVB_ENDPOINT_TALKER_CALLBACK;
memcpy(&(msgBuf.streamID), streamID, sizeof(AVBStreamID_t));
- strncpy(msgBuf.params.talkerCallback.ifname, ifname, IFNAMSIZ - 1);
+ strncpy(msgBuf.params.talkerCallback.ifname, ifname, sizeof(msgBuf.params.talkerCallback.ifname) - 1);
memcpy(msgBuf.params.talkerCallback.destAddr, destAddr, ETH_ALEN);
msgBuf.params.talkerCallback.lsnrDecl = lsnrDecl;
msgBuf.params.talkerCallback.srClass = srClass;
@@ -174,7 +174,7 @@ void openavbEptSrvrNotifyLstnrOfSrpCb(int h,
memset(&msgBuf, 0, OPENAVB_ENDPOINT_MSG_LEN);
msgBuf.type = OPENAVB_ENDPOINT_LISTENER_CALLBACK;
memcpy(&(msgBuf.streamID), streamID, sizeof(AVBStreamID_t));
- strncpy(msgBuf.params.listenerCallback.ifname, ifname, IFNAMSIZ - 1);
+ strncpy(msgBuf.params.listenerCallback.ifname, ifname, sizeof(msgBuf.params.listenerCallback.ifname) - 1);
if (destAddr)
memcpy(msgBuf.params.listenerCallback.destAddr, destAddr, ETH_ALEN);
msgBuf.params.listenerCallback.tlkrDecl = tlkrDecl;
diff --git a/lib/avtp_pipeline/include/openavb_audio_pub.h b/lib/avtp_pipeline/include/openavb_audio_pub.h
index 46f3e03e..1e50d45a 100644
--- a/lib/avtp_pipeline/include/openavb_audio_pub.h
+++ b/lib/avtp_pipeline/include/openavb_audio_pub.h
@@ -2,16 +2,16 @@
Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
Copyright (c) 2016-2017, Harman International Industries, Incorporated
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Attributions: The inih library portion of the source code is licensed from
-Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
-Complete license and copyright information can be found at
+
+Attributions: The inih library portion of the source code is licensed from
+Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
+Complete license and copyright information can be found at
https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
*************************************************************************************************************/
@@ -51,6 +51,8 @@ typedef enum {
AVB_AUDIO_RATE_16KHZ = 16000,
/// 22050
AVB_AUDIO_RATE_22_05KHZ = 22050,
+ /// 24000
+ AVB_AUDIO_RATE_24KHZ = 24000,
/// 32000
AVB_AUDIO_RATE_32KHZ = 32000,
/// 44100
diff --git a/lib/avtp_pipeline/map_aaf_audio/openavb_map_aaf_audio.c b/lib/avtp_pipeline/map_aaf_audio/openavb_map_aaf_audio.c
index ef3b4a91..f9501750 100755
--- a/lib/avtp_pipeline/map_aaf_audio/openavb_map_aaf_audio.c
+++ b/lib/avtp_pipeline/map_aaf_audio/openavb_map_aaf_audio.c
@@ -82,6 +82,7 @@ typedef enum {
AAF_RATE_96K,
AAF_RATE_176K4,
AAF_RATE_192K,
+ AAF_RATE_24K,
} aaf_nominal_sample_rate_t;
typedef enum {
@@ -141,7 +142,8 @@ typedef struct {
aaf_sample_format_t aaf_format;
U8 aaf_bit_depth;
U32 payloadSize;
- U32 payloadSizeMax;
+ U32 payloadSizeMaxTalker, payloadSizeMaxListener;
+ bool isTalker;
U8 aaf_event_field;
@@ -174,6 +176,9 @@ static void x_calculateSizes(media_q_t *pMediaQ)
case AVB_AUDIO_RATE_16KHZ:
pPvtData->aaf_rate = AAF_RATE_16K;
break;
+ case AVB_AUDIO_RATE_24KHZ:
+ pPvtData->aaf_rate = AAF_RATE_24K;
+ break;
case AVB_AUDIO_RATE_32KHZ:
pPvtData->aaf_rate = AAF_RATE_32K;
break;
@@ -274,7 +279,7 @@ static void x_calculateSizes(media_q_t *pMediaQ)
// AAF packet size calculations
pPubMapInfo->packetFrameSizeBytes = pPubMapInfo->packetSampleSizeBytes * pPubMapInfo->audioChannels;
- pPvtData->payloadSize = pPvtData->payloadSizeMax =
+ pPvtData->payloadSize = pPvtData->payloadSizeMaxTalker = pPvtData->payloadSizeMaxListener =
pPubMapInfo->framesPerPacket * pPubMapInfo->packetFrameSizeBytes;
AVB_LOGF_INFO("packet: sampleSz=%d * channels=%d => frameSz=%d * %d => payloadSz=%d",
pPubMapInfo->packetSampleSizeBytes,
@@ -284,8 +289,8 @@ static void x_calculateSizes(media_q_t *pMediaQ)
pPvtData->payloadSize);
if (pPvtData->aaf_format >= AAF_FORMAT_INT_32 && pPvtData->aaf_format <= AAF_FORMAT_INT_16) {
// Determine the largest size we could receive before adjustments.
- pPvtData->payloadSizeMax = 4 * pPubMapInfo->audioChannels * pPubMapInfo->framesPerPacket;
- AVB_LOGF_DEBUG("packet: payloadSizeMax=%d", pPvtData->payloadSizeMax);
+ pPvtData->payloadSizeMaxListener = 4 * pPubMapInfo->audioChannels * pPubMapInfo->framesPerPacket;
+ AVB_LOGF_DEBUG("packet: payloadSizeMaxListener=%d", pPvtData->payloadSizeMaxListener);
}
// MediaQ item size calculations
@@ -384,8 +389,17 @@ U16 openavbMapAVTPAudioMaxDataSizeCB(media_q_t *pMediaQ)
return 0;
}
+ // Return the largest size a frame payload could be.
+ // If we don't yet know if we are a Talker or Listener, the larger Listener max will be returned.
+ U16 payloadSizeMax;
+ if (pPvtData->isTalker) {
+ payloadSizeMax = pPvtData->payloadSizeMaxTalker + TOTAL_HEADER_SIZE;
+ }
+ else {
+ payloadSizeMax = pPvtData->payloadSizeMaxListener + TOTAL_HEADER_SIZE;
+ }
AVB_TRACE_EXIT(AVB_TRACE_MAP);
- return pPvtData->payloadSizeMax + TOTAL_HEADER_SIZE;
+ return payloadSizeMax;
}
AVB_TRACE_EXIT(AVB_TRACE_MAP);
return 0;
@@ -433,6 +447,12 @@ void openavbMapAVTPAudioGenInitCB(media_q_t *pMediaQ)
void openavbMapAVTPAudioTxInitCB(media_q_t *pMediaQ)
{
AVB_TRACE_ENTRY(AVB_TRACE_MAP);
+ if (pMediaQ) {
+ pvt_data_t *pPvtData = pMediaQ->pPvtMapInfo;
+ if (pPvtData) {
+ pPvtData->isTalker = TRUE;
+ }
+ }
AVB_TRACE_EXIT(AVB_TRACE_MAP);
}
@@ -481,16 +501,16 @@ tx_cb_ret_t openavbMapAVTPAudioTxCB(media_q_t *pMediaQ, U8 *pData, U32 *dataLen)
return TX_CB_RET_PACKET_NOT_READY;
}
+ U32 tmp32;
+ U8 *pHdrV0 = pData;
+ U32 *pHdr = (U32 *)(pData + AVTP_V0_HEADER_SIZE);
+ U8 *pPayload = pData + TOTAL_HEADER_SIZE;
+
U32 bytesProcessed = 0;
while (bytesProcessed < bytesNeeded) {
pMediaQItem = openavbMediaQTailLock(pMediaQ, TRUE);
if (pMediaQItem && pMediaQItem->pPubData && pMediaQItem->dataLen > 0) {
- U32 tmp32;
- U8 *pHdrV0 = pData;
- U32 *pHdr = (U32 *)(pData + AVTP_V0_HEADER_SIZE);
- U8 *pPayload = pData + TOTAL_HEADER_SIZE;
-
// timestamp set in the interface module, here just validate
// In sparse mode, the timestamp valid flag should be set every eighth AAF AVPTDU.
if (pPvtData->sparseMode == TS_SPARSE_MODE_ENABLED && (pHdrV0[HIDX_AVTP_SEQ_NUM] & 0x07) != 0) {
@@ -587,6 +607,7 @@ void openavbMapAVTPAudioRxInitCB(media_q_t *pMediaQ)
AVB_LOG_ERROR("Private mapping module data not allocated.");
return;
}
+ pPvtData->isTalker = FALSE;
if (pPvtData->audioMcr != AVB_MCR_NONE) {
HAL_INIT_MCR_V2(pPvtData->txInterval, pPvtData->packingFactor, pPvtData->mcrTimestampInterval, pPvtData->mcrRecoveryInterval);
}
@@ -858,8 +879,8 @@ void openavbMapAVTPAudioEndCB(media_q_t *pMediaQ)
void openavbMapAVTPAudioGenEndCB(media_q_t *pMediaQ)
{
- AVB_TRACE_ENTRY(AVB_TRACE_INTF);
- AVB_TRACE_EXIT(AVB_TRACE_INTF);
+ AVB_TRACE_ENTRY(AVB_TRACE_MAP);
+ AVB_TRACE_EXIT(AVB_TRACE_MAP);
}
// Initialization entry point into the mapping module. Will need to be included in the .ini file.
diff --git a/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_cfg.c b/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_cfg.c
index cdf70181..9c22fc36 100644
--- a/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_cfg.c
+++ b/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_cfg.c
@@ -79,7 +79,7 @@ static int cfgCallback(void *user, const char *section, const char *name, const
{
if_info_t ifinfo;
if (openavbCheckInterface(value, &ifinfo)) {
- strncpy(pCfg->ifname, value, IFNAMSIZ - 1);
+ strncpy(pCfg->ifname, value, sizeof(pCfg->ifname) - 1);
memcpy(pCfg->ifmac, &ifinfo.mac, ETH_ALEN);
valOK = TRUE;
}
diff --git a/lib/avtp_pipeline/platform/Linux/endpoint/openavb_endpoint_cfg.c b/lib/avtp_pipeline/platform/Linux/endpoint/openavb_endpoint_cfg.c
index 7e0b53c6..6794a84b 100644
--- a/lib/avtp_pipeline/platform/Linux/endpoint/openavb_endpoint_cfg.c
+++ b/lib/avtp_pipeline/platform/Linux/endpoint/openavb_endpoint_cfg.c
@@ -2,16 +2,16 @@
Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
Copyright (c) 2016-2017, Harman International Industries, Incorporated
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Attributions: The inih library portion of the source code is licensed from
-Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
-Complete license and copyright information can be found at
+
+Attributions: The inih library portion of the source code is licensed from
+Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
+Complete license and copyright information can be found at
https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
*************************************************************************************************************/
@@ -76,9 +76,9 @@ static int cfgCallback(void *user, const char *section, const char *name, const
AVB_TRACE_EXIT(AVB_TRACE_ENDPOINT);
return 0;
}
-
+
openavb_endpoint_cfg_t *pCfg = (openavb_endpoint_cfg_t*)user;
-
+
AVB_LOGF_DEBUG("name=[%s] value=[%s]", name, value);
bool valOK = FALSE;
@@ -90,7 +90,7 @@ static int cfgCallback(void *user, const char *section, const char *name, const
{
if_info_t ifinfo;
if (openavbCheckInterface(value, &ifinfo)) {
- strncpy(pCfg->ifname, value, IFNAMSIZ - 1);
+ strncpy(pCfg->ifname, value, sizeof(pCfg->ifname) - 1);
memcpy(pCfg->ifmac, &ifinfo.mac, ETH_ALEN);
pCfg->ifindex = ifinfo.index;
pCfg->mtu = ifinfo.mtu;
diff --git a/lib/avtp_pipeline/platform/Linux/rawsock/simple_rawsock.c b/lib/avtp_pipeline/platform/Linux/rawsock/simple_rawsock.c
index 18293a37..c903ae43 100644
--- a/lib/avtp_pipeline/platform/Linux/rawsock/simple_rawsock.c
+++ b/lib/avtp_pipeline/platform/Linux/rawsock/simple_rawsock.c
@@ -55,7 +55,7 @@ bool simpleAvbCheckInterface(const char *ifname, if_info_t *info)
memset(info, 0, sizeof(if_info_t));
AVB_LOGF_DEBUG("ifname=%s", ifname);
- strncpy(info->name, ifname, IFNAMSIZ - 1);
+ strncpy(info->name, ifname, sizeof(info->name) - 1);
// open a throw-away socket - used for our ioctls
int sk = socket(AF_INET, SOCK_STREAM, 0);
diff --git a/lib/avtp_pipeline/platform/Linux/tl/openavb_tl_osal.c b/lib/avtp_pipeline/platform/Linux/tl/openavb_tl_osal.c
index f9e7d1f1..8f3cf82b 100644
--- a/lib/avtp_pipeline/platform/Linux/tl/openavb_tl_osal.c
+++ b/lib/avtp_pipeline/platform/Linux/tl/openavb_tl_osal.c
@@ -2,16 +2,16 @@
Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
Copyright (c) 2016-2017, Harman International Industries, Incorporated
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Attributions: The inih library portion of the source code is licensed from
-Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
-Complete license and copyright information can be found at
+
+Attributions: The inih library portion of the source code is licensed from
+Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
+Complete license and copyright information can be found at
https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
*************************************************************************************************************/
@@ -317,7 +317,7 @@ static int openavbTLCfgCallback(void *user, const char *tlSection, const char *n
}
}
else if (MATCH(name, "ifname")) {
- strncpy(pCfg->ifname, value, IFNAMSIZ - 1);
+ strncpy(pCfg->ifname, value, sizeof(pCfg->ifname) - 1);
valOK = TRUE;
}
else if (MATCH(name, "vlan_id")) {
diff --git a/lib/avtp_pipeline/qmgr/openavb_qmgr.c b/lib/avtp_pipeline/qmgr/openavb_qmgr.c
index d3a9b84a..5c054eb2 100644
--- a/lib/avtp_pipeline/qmgr/openavb_qmgr.c
+++ b/lib/avtp_pipeline/qmgr/openavb_qmgr.c
@@ -2,16 +2,16 @@
Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
Copyright (c) 2016-2017, Harman International Industries, Incorporated
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Attributions: The inih library portion of the source code is licensed from
-Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
-Complete license and copyright information can be found at
+
+Attributions: The inih library portion of the source code is licensed from
+Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
+Complete license and copyright information can be found at
https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
*************************************************************************************************************/
@@ -275,7 +275,7 @@ bool openavbQmgrInitialize(int mode, int ifindex, const char* ifname, unsigned m
// Save the configuration
if (ifname)
- strncpy(qdisc_data.ifname, ifname, IFNAMSIZ - 1);
+ strncpy(qdisc_data.ifname, ifname, sizeof(qdisc_data.ifname) - 1);
qdisc_data.ifindex = ifindex;
qdisc_data.linkKbit = link_kbit;
qdisc_data.linkMTU = mtu;
diff --git a/lib/avtp_pipeline/tl/openavb_listener_endpoint.c b/lib/avtp_pipeline/tl/openavb_listener_endpoint.c
index 95c2b215..6280266c 100644
--- a/lib/avtp_pipeline/tl/openavb_listener_endpoint.c
+++ b/lib/avtp_pipeline/tl/openavb_listener_endpoint.c
@@ -2,16 +2,16 @@
Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
Copyright (c) 2016-2017, Harman International Industries, Incorporated
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Attributions: The inih library portion of the source code is licensed from
-Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
-Complete license and copyright information can be found at
+
+Attributions: The inih library portion of the source code is licensed from
+Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
+Complete license and copyright information can be found at
https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
*************************************************************************************************************/
@@ -91,9 +91,9 @@ void openavbEptClntNotifyLstnrOfSrpCb(int endpointHandle,
if (rc) {
// Save data provided by endpoint/SRP
if (!pCfg->ifname[0]) {
- strncpy(pListenerData->ifname, ifname, IFNAMSIZ);
+ strncpy(pListenerData->ifname, ifname, sizeof(pListenerData->ifname) - 1);
} else {
- strncpy(pListenerData->ifname, pCfg->ifname, IFNAMSIZ);
+ strncpy(pListenerData->ifname, pCfg->ifname, sizeof(pListenerData->ifname) - 1);
}
memcpy(&pListenerData->streamID, streamID, sizeof(AVBStreamID_t));
if (memcmp(destAddr, emptyMAC, ETH_ALEN) != 0) {
diff --git a/lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c b/lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c
index d006b708..f7336f68 100644
--- a/lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c
+++ b/lib/avtp_pipeline/tl/openavb_listener_no_endpoint.c
@@ -2,16 +2,16 @@
Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
Copyright (c) 2016-2017, Harman International Industries, Incorporated
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -22,10 +22,10 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Attributions: The inih library portion of the source code is licensed from
-Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
-Complete license and copyright information can be found at
+
+Attributions: The inih library portion of the source code is licensed from
+Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
+Complete license and copyright information can be found at
https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
*************************************************************************************************************/
@@ -52,7 +52,7 @@ bool openavbTLRunListenerInit(int hnd, AVBStreamID_t *streamID)
openavb_tl_cfg_t *pCfg = &pTLState->cfg;
listener_data_t *pListenerData = pTLState->pPvtListenerData;
- strncpy(pListenerData->ifname, pCfg->ifname, IFNAMSIZ);
+ strncpy(pListenerData->ifname, pCfg->ifname, sizeof(pListenerData->ifname) - 1);
memcpy(&pListenerData->streamID.addr, &pCfg->stream_addr.mac->ether_addr_octet, ETH_ALEN);
pListenerData->streamID.uniqueID = pCfg->stream_uid;
memcpy(&pListenerData->destAddr, &pCfg->dest_addr.mac->ether_addr_octet, ETH_ALEN);
@@ -62,7 +62,7 @@ bool openavbTLRunListenerInit(int hnd, AVBStreamID_t *streamID)
AVB_LOGF_INFO("Dest Addr: "ETH_FORMAT, ETH_OCTETS(pListenerData->destAddr));
AVB_LOGF_INFO("Starting stream: "STREAMID_FORMAT, STREAMID_ARGS(streamID));
listenerStartStream(pTLState);
-
+
return TRUE;
}
diff --git a/lib/avtp_pipeline/tl/openavb_talker_endpoint.c b/lib/avtp_pipeline/tl/openavb_talker_endpoint.c
index e3343e78..c1a5eb4e 100644
--- a/lib/avtp_pipeline/tl/openavb_talker_endpoint.c
+++ b/lib/avtp_pipeline/tl/openavb_talker_endpoint.c
@@ -90,9 +90,9 @@ void openavbEptClntNotifyTlkrOfSrpCb(int endpointHandle,
// Save the data provided by endpoint/SRP
if (!pCfg->ifname[0]) {
- strncpy(pTalkerData->ifname, ifname, IFNAMSIZ);
+ strncpy(pTalkerData->ifname, ifname, sizeof(pTalkerData->ifname) - 1);
} else {
- strncpy(pTalkerData->ifname, pCfg->ifname, IFNAMSIZ);
+ strncpy(pTalkerData->ifname, pCfg->ifname, sizeof(pTalkerData->ifname) - 1);
}
memcpy(&pTalkerData->streamID, streamID, sizeof(AVBStreamID_t));
memcpy(&pTalkerData->destAddr, destAddr, ETH_ALEN);
@@ -109,9 +109,9 @@ void openavbEptClntNotifyTlkrOfSrpCb(int endpointHandle,
else if (lsnrDecl == openavbSrp_LDSt_Stream_Info) {
// Stream information is available does NOT mean listener is ready. Stream not started yet.
if (!pCfg->ifname[0]) {
- strncpy(pTalkerData->ifname, ifname, IFNAMSIZ);
+ strncpy(pTalkerData->ifname, ifname, sizeof(pTalkerData->ifname) - 1);
} else {
- strncpy(pTalkerData->ifname, pCfg->ifname, IFNAMSIZ);
+ strncpy(pTalkerData->ifname, pCfg->ifname, sizeof(pTalkerData->ifname) - 1);
}
memcpy(&pTalkerData->streamID, streamID, sizeof(AVBStreamID_t));
memcpy(&pTalkerData->destAddr, destAddr, ETH_ALEN);
diff --git a/lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c b/lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c
index 03cb8ade..90476031 100644
--- a/lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c
+++ b/lib/avtp_pipeline/tl/openavb_talker_no_endpoint.c
@@ -62,11 +62,10 @@ bool openavbTLRunTalkerInit(tl_state_t *pTLState)
talker_data_t *pTalkerData = pTLState->pPvtTalkerData;
//avtp_stream_t *pStream = (avtp_stream_t *)(pTalkerData->avtpHandle);
- strncpy(pTalkerData->ifname, pCfg->ifname, IFNAMSIZ);
+ strncpy(pTalkerData->ifname, pCfg->ifname, sizeof(pTalkerData->ifname) - 1);
// CORE_TODO: It would be good to have some parts of endpoint moved into non-endpoint general code to handle some the stream
// configuration values.
- // strncpy(pTalkerData->ifname, pCfg->ifname, IFNAMSIZ);
if (pCfg->stream_addr.mac) {
memcpy(pTalkerData->streamID.addr, pCfg->stream_addr.mac, ETH_ALEN);
}else {
diff --git a/lib/avtp_pipeline/tl/openavb_tl_pub.h b/lib/avtp_pipeline/tl/openavb_tl_pub.h
index d89729a1..a5f3da69 100755
--- a/lib/avtp_pipeline/tl/openavb_tl_pub.h
+++ b/lib/avtp_pipeline/tl/openavb_tl_pub.h
@@ -74,7 +74,9 @@ typedef enum {
/// Maximum size of interface name
-#define IFNAMSIZE 16
+#ifndef IFNAMSIZ
+#define IFNAMSIZ 16
+#endif
/// Maximum size of the friendly name
#define FRIENDLY_NAME_SIZE 64
@@ -139,7 +141,7 @@ typedef struct {
/// Is the interface module blocking in the TX CB.
bool tx_blocking_in_intf;
/// Network interface name. Not used on all platforms.
- char ifname[IFNAMSIZE];
+ char ifname[IFNAMSIZ + 10]; // Include space for the socket type prefix (e.g. "simple:eth0")
/// VLAN ID
U16 vlan_id;
/// When set incoming packets will trigger a signal to the stream task to wakeup.