[PATCH] Adding APA terms to glossary

2020-06-19 Thread Richi Dubey
---
 c-user/glossary.rst | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/c-user/glossary.rst b/c-user/glossary.rst
index 86350a8..691ba52 100644
--- a/c-user/glossary.rst
+++ b/c-user/glossary.rst
@@ -1,5 +1,6 @@
 .. SPDX-License-Identifier: CC-BY-SA-4.0
 
+.. Copyright (C) 2020 Richi Dubey (richidu...@gmail.com)
 .. Copyright (C) 2017, 2019 embedded brains GmbH 
(http://www.embedded-brains.de)
 .. Copyright (C) 1988, 1998 On-Line Applications Research Corporation (OAR)
 
@@ -16,6 +17,13 @@ Glossary
 A term used to describe an object which has been created by an
 application.
 
+APA
+This term is an acronym for Arbitrary Processor Affinity.
+APA schedulers allow a thread to have an arbitrary affinity to
+a processor set, rather than a restricted mapping to only one 
+processor of the set or the ability to run on all processors of 
+the set. It has two variants, :term:`Weak APA` and :term:`Strong APA`
+
 aperiodic task
 A task which must execute only at irregular intervals and has only a 
soft
 deadline.
@@ -777,6 +785,19 @@ Glossary
 :term:`return value` to indicate a successful operation or error
 conditions.
 
+Strong APA
+Strong APA is a specialization of :term:`APA`. 
+Whenever a :term:`thread` becomes ready for execution, schedulers 
which 
+implement strong APA recursively search for a processor in the 
thread's 
+affinity set, followed by the processors in the affinity set of 
threads 
+that are assigned the processor present in the ready thread's affinity 
set. 
+This is done to find a thread to processor mapping that does not 
violate the 
+priority ordering and to provide a schedule with a higher total 
priority of 
+the threads scheduled. 
+Similar analysis is done when a thread finishes its execution.
+
+See also :cite:`Cerqueira:2014:LPA`.
+
 suspend
 A term used to describe a task that is not competing for the CPU 
because it
 has had a ``rtems_task_suspend`` directive.
@@ -905,6 +926,16 @@ Glossary
 Message queues, regions, and semaphores have a wait queue associated 
with
 them.
 
+Weak APA
+Weak APA is a specialization of :term:`APA`. This refers to Linux's 
push and 
+pull implementation of APA model. On the arrival of a thread, the 
thread is 
+scheduled when a processor in its affinity set is idle or a processor 
in its 
+affinity set is executing a thread which is at a lower priority. 
+Unlike :term:`Strong APA`, no thread is migrated from its processor to 
find 
+a thread to processor mapping.
+
+See also :cite:`Cerqueira:2014:LPA`.
+
 YAML
 This term is an acronym for `YAML Ain't Markup Language 
`_.
 
-- 
2.17.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] APA definitions

2020-06-19 Thread Richi Dubey
Hi,
Thanks again for your detailed explanation and review. I've sent in the new
patch with the changes. Also writing 'qa' after visually selecting words by
pressing v did not do anything. I also search the docs on
http://vimdoc.sourceforge.net/htmldoc/editing.html but couldn't find
anything. What is qa supposed to do? Is it related to formatting?

Please let me know.

Thanks,
Richi.

On Thu, Jun 18, 2020 at 10:42 PM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 17/06/2020 14:13, Richi Dubey wrote:
>
> > ---
> >   c-user/glossary.rst | 29 +
> >   1 file changed, 29 insertions(+)
> >
> > diff --git a/c-user/glossary.rst b/c-user/glossary.rst
> > index 86350a8..1d95f26 100644
> > --- a/c-user/glossary.rst
> > +++ b/c-user/glossary.rst
> > @@ -1,5 +1,6 @@
> >   .. SPDX-License-Identifier: CC-BY-SA-4.0
> >
> > +.. Copyright (C) 2020 Richi Dubey (richidu...@gmail.com)
> >   .. Copyright (C) 2017, 2019 embedded brains GmbH (
> http://www.embedded-brains.de)
> >   .. Copyright (C) 1988, 1998 On-Line Applications Research Corporation
> (OAR)
> >
> > @@ -16,6 +17,13 @@ Glossary
> >   A term used to describe an object which has been created by an
> >   application.
> >
> > +APA
> > +This term is an acronym for Arbitrary Processor Affinity.
> > +In this model,
> Model of what?
> > a thread is allowed to have an arbitrary affinity to
> > +the processor set, rather than a global mapping from one thread
> to all
>
> Maybe "a processor set"?
>
> I would say: rather than a restricted mapping to only one processor of
> the set or the ability to run on all processors of the set.
>
> > +processors or one thread to one processor.
> > +It has two variants, :term:`Weak APA` and :term:`Strong APA`.
> > +
> >   aperiodic task
> >   A task which must execute only at irregular intervals and has
> only a soft
> >   deadline.
> > @@ -777,6 +785,19 @@ Glossary
> >   :term:`return value` to indicate a successful operation or
> error
> >   conditions.
> >
> > +Strong APA
> > +Strong APA is a specialization of :term:`APA`.
> > +This variant of APA refers to a system model in which whenever a
> Is it really a system model?
> > +:term:`thread` becomes ready for execution, recursively the
> processor
> > +in the thread's affinity set is checked, followed by the
> processor in
> > +the affinity set of threads that are assigned the processor
> present in
> > +the ready thread's affinity set. This is done to find a thread
> to processor
> > +mapping that does not violate the priority ordering and provide
> a schedule
> > +with a higher total priority of the threads scheduled.
> > +Similar analysis is done when a thread finishes its execution.
> Since you learn vim currently, maybe you can try to visually select this
> paragraph and then type "qa".
> > +
> > + :cite:`Cerqueira:2014:LPA`
> Please use a sentence, for example "See also :cite:`Cerqueira:2014:LPA`".
> > +
> >   suspend
> >   A term used to describe a task that is not competing for the
> CPU because it
> >   has had a ``rtems_task_suspend`` directive.
> > @@ -905,6 +926,14 @@ Glossary
> >   Message queues, regions, and semaphores have a wait queue
> associated with
> >   them.
> >
> > +Weak APA
> > +Weak APA is a specialization of :term:`APA`.
> > +This refers to Linux's pull push implementation of APA model.
> push/pull or "push and pull"
> > +A ready thread is scheduled when a processor in its affinity
> set is idle
> > +or is executing a thread which is at a lower priority.
> Maybe mention that no threads are forced to migrate to find a processor.
> > +
> > +:cite:`Cerqueira:2014:LPA`
> > +
> >   YAML
> >   This term is an acronym for `YAML Ain't Markup Language <
> https://yaml.org/>`_.
> >
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 09/10] mDNSResponder: Update to v878.270.2

2020-06-19 Thread Sebastian Huber
The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.270.2.tar.gz

Update #4010.
---
 mDNSResponder/Makefile|   2 +-
 mDNSResponder/mDNSCore/DNSCommon.c|  15 +-
 mDNSResponder/mDNSCore/DNSCommon.h|   2 +
 mDNSResponder/mDNSCore/dnssec.c   |   2 +-
 mDNSResponder/mDNSCore/mDNS.c |  51 ---
 mDNSResponder/mDNSCore/mDNSDebug.h|   1 +
 mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h  |  22 +--
 mDNSResponder/mDNSCore/uDNS.c | 136 +-
 mDNSResponder/mDNSMacOSX/DNS64.c  |  26 ++--
 mDNSResponder/mDNSMacOSX/DNS64.h  |   4 +-
 mDNSResponder/mDNSMacOSX/daemon.c |   6 +-
 mDNSResponder/mDNSMacOSX/mDNSMacOSX.c | 109 ++
 mDNSResponder/mDNSMacOSX/mDNSMacOSX.h |   7 +-
 .../mDNSResponder.xcodeproj/project.pbxproj   |   8 ++
 mDNSResponder/mDNSPosix/mDNSPosix.c   |   1 +
 mDNSResponder/mDNSShared/dns_sd.h |   2 +-
 mDNSResponder/mDNSShared/dnsextd.c|   2 +-
 mDNSResponder/mDNSShared/uds_daemon.c |   2 +-
 mDNSResponder/unittests/uds_daemon_ut.c   |   2 +-
 19 files changed, 245 insertions(+), 155 deletions(-)

diff --git a/mDNSResponder/Makefile b/mDNSResponder/Makefile
index b647c70a..68ba6b64 100644
--- a/mDNSResponder/Makefile
+++ b/mDNSResponder/Makefile
@@ -17,7 +17,7 @@
 
 include $(MAKEFILEPATH)/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-878.260.1"
+MVERS = "mDNSResponder-878.270.2"
 
 VER =
 ifneq ($(strip $(GCC_VERSION)),)
diff --git a/mDNSResponder/mDNSCore/DNSCommon.c 
b/mDNSResponder/mDNSCore/DNSCommon.c
index f3150762..15a92200 100644
--- a/mDNSResponder/mDNSCore/DNSCommon.c
+++ b/mDNSResponder/mDNSCore/DNSCommon.c
@@ -1790,8 +1790,8 @@ mDNSexport mDNSBool SameNameRecordAnswersQuestion(const 
ResourceRecord *const rr
 // Resource record received via unicast, the resolver group ID should 
match ?
 if (!rr->InterfaceID)
 {
-mDNSu16 idr = (rr->rDNSServer ? rr->rDNSServer->resGroupID : 0);
-mDNSu16 idq = (q->qDNSServer ? q->qDNSServer->resGroupID : 0);
+const mDNSu32 idr = rr->rDNSServer ? rr->rDNSServer->resGroupID : 0;
+const mDNSu32 idq = q->qDNSServer ? q->qDNSServer->resGroupID : 0;
 if (idr != idq) return(mDNSfalse);
 if (!DNSSECRecordAnswersQuestion(rr, q, &checkType)) return mDNSfalse;
 }
@@ -1924,8 +1924,8 @@ mDNSexport mDNSBool AnyTypeRecordAnswersQuestion(const 
ResourceRecord *const rr,
 // both the DNSServers are assumed to be NULL in that case
 if (!rr->InterfaceID)
 {
-mDNSu16 idr = (rr->rDNSServer ? rr->rDNSServer->resGroupID : 0);
-mDNSu16 idq = (q->qDNSServer ? q->qDNSServer->resGroupID : 0);
+const mDNSu32 idr = rr->rDNSServer ? rr->rDNSServer->resGroupID : 0;
+const mDNSu32 idq = q->qDNSServer ? q->qDNSServer->resGroupID : 0;
 if (idr != idq) return(mDNSfalse);
 }
 
@@ -4551,3 +4551,10 @@ mDNSexport mDNSu32 mDNS_snprintf(char *sbuffer, mDNSu32 
buflen, const char *fmt,
 
 return(length);
 }
+
+mDNSexport mDNSu32 mDNS_GetNextResolverGroupID(void)
+{
+static mDNSu32 lastID = 0;
+if (++lastID == 0) lastID = 1; // Valid resolver group IDs are non-zero.
+return(lastID);
+}
diff --git a/mDNSResponder/mDNSCore/DNSCommon.h 
b/mDNSResponder/mDNSCore/DNSCommon.h
index 48dfe102..4291577e 100644
--- a/mDNSResponder/mDNSCore/DNSCommon.h
+++ b/mDNSResponder/mDNSCore/DNSCommon.h
@@ -98,6 +98,8 @@ extern mDNSInterfaceID GetNextActiveInterfaceID(const 
NetworkInterfaceInfo *intf
 
 extern mDNSu32 mDNSRandom(mDNSu32 max); // Returns pseudo-random result 
from zero to max inclusive
 
+extern mDNSu32 mDNS_GetNextResolverGroupID(void);
+
 // ***
 #if COMPILER_LIKES_PRAGMA_MARK
 #pragma mark -
diff --git a/mDNSResponder/mDNSCore/dnssec.c b/mDNSResponder/mDNSCore/dnssec.c
index 9525655f..3010d6f2 100644
--- a/mDNSResponder/mDNSCore/dnssec.c
+++ b/mDNSResponder/mDNSCore/dnssec.c
@@ -3084,7 +3084,7 @@ mDNSexport void VerifySignature(mDNS *const m, 
DNSSECVerifier *dv, DNSQuestion *
 if (!dv)
 {
 first = mDNStrue;
-if (!q->qDNSServer || q->qDNSServer->cellIntf)
+if (!q->qDNSServer || q->qDNSServer->isCell)
 {
 LogDNSSEC("VerifySignature: Disabled");
 return;
diff --git a/mDNSResponder/mDNSCore/mDNS.c b/mDNSResponder/mDNSCore/mDNS.c
index bf1bce2f..4e70ef83 100755
--- a/mDNSResponder/mDNSCore/mDNS.c
+++ b/mDNSResponder/mDNSCore/mDNS.c
@@ -4170,7 +4170,7 @@ mDNSexport void 
AnswerCurrentQuestionWithResourceRecord(mDNS *const m, CacheReco
 mDNSBoolisForCellular;
 
 queryName = q->metrics.originalQName ? q->metrics.originalQName : 
&q->qname;
-isForCellular = (q->qDNSServer && q->qDNSServer->cellIntf);
+isForCellular = (q->qD

[PATCH 08/10] mDNSResponder: Update to v878.260.1

2020-06-19 Thread Sebastian Huber
The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.260.1.tar.gz

Update #4010.
---
 mDNSResponder/Makefile   |   2 +-
 mDNSResponder/mDNSCore/mDNS.c|  19 +-
 mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h |   2 +-
 mDNSResponder/mDNSMacOSX/mDNSMacOSX.c| 336 +++
 mDNSResponder/mDNSMacOSX/mDNSMacOSX.h|   2 -
 mDNSResponder/mDNSShared/dns_sd.h|   2 +-
 6 files changed, 176 insertions(+), 187 deletions(-)

diff --git a/mDNSResponder/Makefile b/mDNSResponder/Makefile
index 9aaa08eb..b647c70a 100644
--- a/mDNSResponder/Makefile
+++ b/mDNSResponder/Makefile
@@ -17,7 +17,7 @@
 
 include $(MAKEFILEPATH)/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-878.250.4"
+MVERS = "mDNSResponder-878.260.1"
 
 VER =
 ifneq ($(strip $(GCC_VERSION)),)
diff --git a/mDNSResponder/mDNSCore/mDNS.c b/mDNSResponder/mDNSCore/mDNS.c
index 9e1ac506..bf1bce2f 100755
--- a/mDNSResponder/mDNSCore/mDNS.c
+++ b/mDNSResponder/mDNSCore/mDNS.c
@@ -6092,7 +6092,7 @@ mDNSexport mStatus UpdateKeepaliveRData(mDNS *const m, 
AuthRecord *rr, NetworkIn
 }
 if ((intf != mDNSNULL) && (mti.IntfId != intf->InterfaceID))
 {
-LogInfo("mDNSPlatformRetrieveTCPInfo: InterfaceID  mismatch 
mti.IntfId = %p InterfaceID = %p",  mti.IntfId, intf->InterfaceID);
+LogInfo("mDNSPlatformRetrieveTCPInfo: InterfaceID mismatch 
mti.IntfId = %p InterfaceID = %p",  mti.IntfId, intf->InterfaceID);
 return mStatus_BadParamErr;
 }
 
@@ -6661,6 +6661,7 @@ mDNSlocal void BeginSleepProcessing(mDNS *const m)
 NetworkInterfaceInfo *intf;
 for (intf = GetFirstActiveInterface(m->HostInterfaces); intf; intf = 
GetFirstActiveInterface(intf->next))
 {
+mDNSBool skipFullSleepProxyRegistration = mDNSfalse;
 // Intialize it to false. These values make sense only when 
SleepState is set to Sleeping.
 intf->SendGoodbyes = 0;
 
@@ -6687,18 +6688,21 @@ mDNSlocal void BeginSleepProcessing(mDNS *const m)
 continue;
 }
 
-// Check if we have already registered with a sleep proxy for this 
subnet
+// Check if we have already registered with a sleep proxy for this 
subnet.
+// If so, then the subsequent in-NIC sleep proxy registration is 
limited to any keepalive records that belong
+// to the interface.
 if (skipSameSubnetRegistration(m, registeredIntfIDS, 
registeredCount, intf->InterfaceID))
 {
-LogSPS("%s : Skipping sleep proxy registration on %s", 
__func__, intf->ifname);
-continue;
+LogSPS("%s : Skipping full sleep proxy registration on %s", 
__func__, intf->ifname);
+skipFullSleepProxyRegistration = mDNStrue;
 }
 
 #if APPLE_OSX_mDNSResponder
-else if (SupportsInNICProxy(intf))
+if (SupportsInNICProxy(intf))
 {
 mDNSBool keepaliveOnly = mDNSfalse;
-if (ActivateLocalProxy(intf, &keepaliveOnly) == 
mStatus_NoError)
+const mStatus err = ActivateLocalProxy(intf, 
skipFullSleepProxyRegistration, &keepaliveOnly);
+if (!skipFullSleepProxyRegistration && !err)
 {
 SendGoodbyesForWakeOnlyService(m, &WakeOnlyService);
 
@@ -6716,9 +6720,10 @@ mDNSlocal void BeginSleepProcessing(mDNS *const m)
 registeredIntfIDS[registeredCount] = intf->InterfaceID;
 registeredCount++;
 }
+continue;
 }
 #endif // APPLE_OSX_mDNSResponder
-else
+if (!skipFullSleepProxyRegistration)
 {
 #if APPLE_OSX_mDNSResponder
 // If on battery, do not attempt to offload to external sleep 
proxies
diff --git a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h 
b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
index 26c70089..e9f3bb8a 100755
--- a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
+++ b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
@@ -3390,7 +3390,7 @@ extern void RemoveAutoTunnel6Record(mDNS *const m);
 extern mDNSBool RecordReadyForSleep(AuthRecord *rr);
 // For now this LocalSleepProxy stuff is specific to Mac OS X.
 // In the future, if there's demand, we may see if we can abstract it out 
cleanly into the platform layer
-extern mStatus ActivateLocalProxy(NetworkInterfaceInfo *const intf, mDNSBool 
*keepaliveOnly);
+extern mStatus ActivateLocalProxy(NetworkInterfaceInfo *const intf, mDNSBool 
offloadKeepAlivesOnly, mDNSBool *keepaliveOnly);
 extern void mDNSPlatformUpdateDNSStatus(DNSQuestion *q);
 extern void mDNSPlatformTriggerDNSRetry(DNSQuestion *v4q, DNSQuestion *v6q);
 extern void mDNSPlatformLogToFile(int log_level, const char *buffer);
diff --git a/mDNSResponder/mDNSMacOSX/mDNSMacOSX.c 
b/mDNSResponder/mDNSMacOSX/mDNSMacOSX.c
index 47142935..b7e53032 100644
-

[PATCH 10/10] mDNSResponder: Port to RTEMS

2020-06-19 Thread Sebastian Huber
Update #4010.
---
 mDNSResponder/mDNSCore/anonymous.c  | 15 --
 mDNSResponder/mDNSCore/mDNS.c   |  4 ++
 mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h| 40 ++
 mDNSResponder/mDNSPosix/mDNSPosix.c | 58 +
 mDNSResponder/mDNSPosix/mDNSPosix.h |  6 +++
 mDNSResponder/mDNSPosix/mDNSUNP.c   |  2 +-
 mDNSResponder/mDNSShared/dnssd_clientshim.c | 13 -
 mDNSResponder/mDNSShared/mDNSDebug.c|  4 ++
 testsuite/foobarserver/test_main.c  |  2 +-
 9 files changed, 136 insertions(+), 8 deletions(-)

diff --git a/mDNSResponder/mDNSCore/anonymous.c 
b/mDNSResponder/mDNSCore/anonymous.c
index 5c138d23..fde3ed80 100644
--- a/mDNSResponder/mDNSCore/anonymous.c
+++ b/mDNSResponder/mDNSCore/anonymous.c
@@ -274,12 +274,17 @@ mDNSexport void SetAnonData(DNSQuestion *q, 
ResourceRecord *rr, mDNSBool ForQues
 }
 }
 
+mDNSlocal char *RRDisplayStringBuf(const ResourceRecord *const rr, char *const 
buffer)
+{
+return GetRRDisplayString_rdb(rr, &rr->rdata->u, buffer);
+}
+
 // returns -1 if the caller should ignore the result
 // returns 1 if the record answers the question
 // returns 0 if the record does not answer the question
 mDNSexport int AnonInfoAnswersQuestion(const ResourceRecord *const rr, const 
DNSQuestion *const q)
 {
-mDNSexport mDNS mDNSStorage;
+char MsgBuffer[MaxMsg]; // Temp storage used while building 
error log messages
 ResourceRecord *nsec3RR;
 int i;
 AnonymousInfo *qai, *rai;
@@ -363,7 +368,7 @@ mDNSexport int AnonInfoAnswersQuestion(const ResourceRecord 
*const rr, const DNS
 mDNSPlatformMemCmp(qai->AnonData, rai->AnonData, qai->AnonDataLen) 
!= 0)
 {
 debugf("AnonInfoAnswersQuestion: AnonData mis-match for record  %s 
question %##s ",
-RRDisplayString(&mDNSStorage, rr), q->qname.c);
+RRDisplayStringBuf(rr, MsgBuffer), q->qname.c);
 return 0;
 }
 // AnonData matches i.e they belong to the same group and the same 
service.
@@ -401,10 +406,10 @@ mDNSexport int AnonInfoAnswersQuestion(const 
ResourceRecord *const rr, const DNS
 // AnonData can be NULL for the cache entry and if we are hearing our 
own question back, AnonData is NULL for
 // that too and we can end up here for that case.
 debugf("AnonInfoAnswersQuestion: AnonData %p or nsec3RR %p, NULL for 
question %##s, record %s", AnonData, nsec3RR,
-q->qname.c, RRDisplayString(&mDNSStorage, rr));
+q->qname.c, RRDisplayStringBuf(rr, MsgBuffer));
 return 0;
 }
-debugf("AnonInfoAnswersQuestion: Validating question %##s, ResourceRecord 
%s", q->qname.c, RRDisplayString(&mDNSStorage, nsec3RR));
+debugf("AnonInfoAnswersQuestion: Validating question %##s, ResourceRecord 
%s", q->qname.c, RRDisplayStringBuf(nsec3RR, MsgBuffer));
 
 
 nsec3 = (rdataNSEC3 *)nsec3RR->rdata->u.data;
@@ -436,7 +441,7 @@ mDNSexport int AnonInfoAnswersQuestion(const ResourceRecord 
*const rr, const DNS
 return 0;
 }
 }
-LogInfo("AnonInfoAnswersQuestion: ResourceRecord %s matched question %##s 
(%s)", RRDisplayString(&mDNSStorage, nsec3RR), q->qname.c, 
DNSTypeName(q->qtype));
+LogInfo("AnonInfoAnswersQuestion: ResourceRecord %s matched question %##s 
(%s)", RRDisplayStringBuf(nsec3RR, MsgBuffer), q->qname.c, 
DNSTypeName(q->qtype));
 return 1;
 }
 
diff --git a/mDNSResponder/mDNSCore/mDNS.c b/mDNSResponder/mDNSCore/mDNS.c
index 4e70ef83..4473e82a 100755
--- a/mDNSResponder/mDNSCore/mDNS.c
+++ b/mDNSResponder/mDNSCore/mDNS.c
@@ -14586,7 +14586,11 @@ mDNSlocal mStatus mDNS_InitStorage(mDNS *const m, 
mDNS_PlatformSupport *const p,
 m->WABBrowseQueriesCount= 0;
 m->WABLBrowseQueriesCount   = 0;
 m->WABRegQueriesCount   = 0;
+#ifndef __rtems__
 m->AutoTargetServices   = 0;
+#else /* __rtems__ */
+m->AutoTargetServices   = 1;
+#endif /* __rtems__ */
 
 #if BONJOUR_ON_DEMAND
 m->NumAllInterfaceRecords   = 0;
diff --git a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h 
b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
index d714de49..ba5dfb3f 100755
--- a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
+++ b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
@@ -3665,6 +3665,46 @@ extern void D2D_stop_advertising_record(AuthRecord *ar);
 
 // ***
 
+#ifdef __rtems__
+typedef struct
+{
+// Client API fields: The client must set up name and InterfaceID *before* 
calling mDNS_StartResolveService()
+// When the callback is invoked, ip, port, TXTlen and TXTinfo will have 
been filled in with the results learned from the network.
+domainname name;
+mDNSInterfaceID InterfaceID;// ID of the interface the response 
was received on
+mDNSAddr ip;// Remote (destination) IP address 
where this service can be accessed
+mDNSIPPort port;   

[PATCH 02/10] mDNSResponder: Update to v878.50.17

2020-06-19 Thread Sebastian Huber
The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.50.17.tar.gz

Update #4010.
---
 mDNSResponder/Clients/dnssdutil.c | 1550 ++---
 mDNSResponder/Makefile|2 +-
 mDNSResponder/mDNSCore/DNSCommon.c|5 +-
 mDNSResponder/mDNSCore/mDNS.c |  133 +-
 mDNSResponder/mDNSCore/uDNS.c |   52 +-
 mDNSResponder/mDNSMacOSX/LegacyNATTraversal.c |3 +-
 mDNSResponder/mDNSShared/CommonServices.h |6 +-
 mDNSResponder/mDNSShared/dns_sd.h |2 +-
 mDNSResponder/mDNSShared/dnsextd.conf |   10 +-
 9 files changed, 1412 insertions(+), 351 deletions(-)

diff --git a/mDNSResponder/Clients/dnssdutil.c 
b/mDNSResponder/Clients/dnssdutil.c
index d1f7c6ca..1bde0daf 100644
--- a/mDNSResponder/Clients/dnssdutil.c
+++ b/mDNSResponder/Clients/dnssdutil.c
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2016-2017 Apple Inc. All rights reserved.
+   Copyright (c) 2016-2018 Apple Inc. All rights reserved.

dnssdutil is a command-line utility for testing the DNS-SD API.
 */
@@ -9,10 +9,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -21,6 +23,7 @@
 #if( TARGET_OS_DARWIN )
#include 
#include 
+   #include 
#include 
 #endif
 
@@ -83,6 +86,8 @@
 #define kDNSServiceProtocolDescriptors \
"\x00" "IPv4\0" \
"\x01" "IPv6\0" \
+   "\x04" "UDP\0"  \
+   "\x05" "TCP\0"  \
"\x00"
 
 // (m)DNS
@@ -165,14 +170,14 @@ static intgDNSSDFlag_SuppressUnusable 
= false;
 static int gDNSSDFlag_Timeout  = false;
 static int gDNSSDFlag_UnicastResponse  = false;
 static int gDNSSDFlag_Unique   = false;
+static int gDNSSDFlag_WakeOnResolve= false;
 
 #define DNSSDFlagsOption() 
\
IntegerOption( 'f', "flags", &gDNSSDFlags, "flags", \
-   "DNSServiceFlags to use. This value is bitwise ORed with other 
single flag options.", false )
+   "DNSServiceFlags as an integer. This value is bitwise ORed with 
other single flag options.", false )
 
-#define DNSSDFlagOption( SHORT_CHAR, FLAG_NAME )   
\
-   BooleanOption( SHORT_CHAR, Stringify( FLAG_NAME ), &gDNSSDFlag_ ## 
FLAG_NAME,   \
-   "Use kDNSServiceFlags" Stringify( FLAG_NAME ) "." )
+#define DNSSDFlagOption( SHORT_CHAR, FLAG_NAME ) \
+   BooleanOption( SHORT_CHAR, # FLAG_NAME, &gDNSSDFlag_ ## FLAG_NAME, "Use 
kDNSServiceFlags" # FLAG_NAME "." )
 
 #define DNSSDFlagsOption_DenyCellular()
DNSSDFlagOption( 'C', DenyCellular )
 #define DNSSDFlagsOption_DenyExpensive()   DNSSDFlagOption( 'E', 
DenyExpensive )
@@ -186,6 +191,7 @@ static int  gDNSSDFlag_Unique   
= false;
 #define DNSSDFlagsOption_Timeout() 
DNSSDFlagOption( 'T', Timeout )
 #define DNSSDFlagsOption_UnicastResponse() DNSSDFlagOption( 'U', 
UnicastResponse )
 #define DNSSDFlagsOption_Unique()  
DNSSDFlagOption( 'U', Unique )
+#define DNSSDFlagsOption_WakeOnResolve()   DNSSDFlagOption( 'W', 
WakeOnResolve )
 
 // Interface option
 
@@ -226,7 +232,7 @@ static const char * gConnectionOpt = 
kConnectionArg_Normal;
"\n"

\
"to specify the delegator by UUID.\n"   

\
"\n"

\
-   "To not use a main connection at all, but instead perform operations on 
their own connections, use\n"   \
+   "To not use a main connection at all, but instead perform operations on 
their own implicit connections, use\n"  \
"\n"


[PATCH 01/10] mDNSResponder: Back to mDNSResponder-878.30.4

2020-06-19 Thread Sebastian Huber
Update #4010.
---
 mDNSResponder/mDNSCore/anonymous.c|  15 +-
 mDNSResponder/mDNSCore/mDNS.c |   4 -
 mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h  |  40 -
 .../mDNSMacOSX/BonjourTop/source/BonjourTop.1 | 156 
 mDNSResponder/mDNSPosix/mDNSPosix.c   |  60 +--
 mDNSResponder/mDNSPosix/mDNSPosix.h   |   6 -
 mDNSResponder/mDNSPosix/mDNSUNP.c |   2 +-
 mDNSResponder/mDNSResponder.sln   |  21 +++
 mDNSResponder/mDNSShared/dnssd_clientshim.c   |  12 +-
 mDNSResponder/mDNSShared/mDNSDebug.c  |   4 -
 .../mDNSWindows/BonjourQuickLooks.sln | 162 -
 .../BonjourQuickLooksInstaller.wixproj| 170 +-
 12 files changed, 273 insertions(+), 379 deletions(-)

diff --git a/mDNSResponder/mDNSCore/anonymous.c 
b/mDNSResponder/mDNSCore/anonymous.c
index fde3ed80..5c138d23 100644
--- a/mDNSResponder/mDNSCore/anonymous.c
+++ b/mDNSResponder/mDNSCore/anonymous.c
@@ -274,17 +274,12 @@ mDNSexport void SetAnonData(DNSQuestion *q, 
ResourceRecord *rr, mDNSBool ForQues
 }
 }
 
-mDNSlocal char *RRDisplayStringBuf(const ResourceRecord *const rr, char *const 
buffer)
-{
-return GetRRDisplayString_rdb(rr, &rr->rdata->u, buffer);
-}
-
 // returns -1 if the caller should ignore the result
 // returns 1 if the record answers the question
 // returns 0 if the record does not answer the question
 mDNSexport int AnonInfoAnswersQuestion(const ResourceRecord *const rr, const 
DNSQuestion *const q)
 {
-char MsgBuffer[MaxMsg]; // Temp storage used while building 
error log messages
+mDNSexport mDNS mDNSStorage;
 ResourceRecord *nsec3RR;
 int i;
 AnonymousInfo *qai, *rai;
@@ -368,7 +363,7 @@ mDNSexport int AnonInfoAnswersQuestion(const ResourceRecord 
*const rr, const DNS
 mDNSPlatformMemCmp(qai->AnonData, rai->AnonData, qai->AnonDataLen) 
!= 0)
 {
 debugf("AnonInfoAnswersQuestion: AnonData mis-match for record  %s 
question %##s ",
-RRDisplayStringBuf(rr, MsgBuffer), q->qname.c);
+RRDisplayString(&mDNSStorage, rr), q->qname.c);
 return 0;
 }
 // AnonData matches i.e they belong to the same group and the same 
service.
@@ -406,10 +401,10 @@ mDNSexport int AnonInfoAnswersQuestion(const 
ResourceRecord *const rr, const DNS
 // AnonData can be NULL for the cache entry and if we are hearing our 
own question back, AnonData is NULL for
 // that too and we can end up here for that case.
 debugf("AnonInfoAnswersQuestion: AnonData %p or nsec3RR %p, NULL for 
question %##s, record %s", AnonData, nsec3RR,
-q->qname.c, RRDisplayStringBuf(rr, MsgBuffer));
+q->qname.c, RRDisplayString(&mDNSStorage, rr));
 return 0;
 }
-debugf("AnonInfoAnswersQuestion: Validating question %##s, ResourceRecord 
%s", q->qname.c, RRDisplayStringBuf(nsec3RR, MsgBuffer));
+debugf("AnonInfoAnswersQuestion: Validating question %##s, ResourceRecord 
%s", q->qname.c, RRDisplayString(&mDNSStorage, nsec3RR));
 
 
 nsec3 = (rdataNSEC3 *)nsec3RR->rdata->u.data;
@@ -441,7 +436,7 @@ mDNSexport int AnonInfoAnswersQuestion(const ResourceRecord 
*const rr, const DNS
 return 0;
 }
 }
-LogInfo("AnonInfoAnswersQuestion: ResourceRecord %s matched question %##s 
(%s)", RRDisplayStringBuf(nsec3RR, MsgBuffer), q->qname.c, 
DNSTypeName(q->qtype));
+LogInfo("AnonInfoAnswersQuestion: ResourceRecord %s matched question %##s 
(%s)", RRDisplayString(&mDNSStorage, nsec3RR), q->qname.c, 
DNSTypeName(q->qtype));
 return 1;
 }
 
diff --git a/mDNSResponder/mDNSCore/mDNS.c b/mDNSResponder/mDNSCore/mDNS.c
index 6657255b..72375d94 100755
--- a/mDNSResponder/mDNSCore/mDNS.c
+++ b/mDNSResponder/mDNSCore/mDNS.c
@@ -14475,11 +14475,7 @@ mDNSlocal mStatus mDNS_InitStorage(mDNS *const m, 
mDNS_PlatformSupport *const p,
 m->WABBrowseQueriesCount= 0;
 m->WABLBrowseQueriesCount   = 0;
 m->WABRegQueriesCount   = 0;
-#ifndef __rtems__
 m->AutoTargetServices   = 0;
-#else /* __rtems__ */
-m->AutoTargetServices   = 1;
-#endif /* __rtems__ */
 
 #if BONJOUR_ON_DEMAND
 m->NumAllInterfaceRecords   = 0;
diff --git a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h 
b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
index 72ff7ca1..1962bb19 100755
--- a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
+++ b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
@@ -3632,46 +3632,6 @@ extern void D2D_stop_advertising_record(AuthRecord *ar);
 
 // ***
 
-#ifdef __rtems__
-typedef struct
-{
-// Client API fields: The client must set up name and InterfaceID *before* 
calling mDNS_StartResolveService()
-// When the callback is invoked, ip, port, TXTlen and TXTinfo will have 
been filled in with the results learned from the network.
-domainname name;
-mDNSInterfaceID Interfa

[PATCH 06/10] mDNSResponder: Update to v878.240.1

2020-06-19 Thread Sebastian Huber
The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.240.1.tar.gz

Update #4010.
---
 mDNSResponder/Makefile |  2 +-
 mDNSResponder/mDNSCore/DNSCommon.c |  4 ++--
 mDNSResponder/mDNSCore/DNSCommon.h |  7 +++
 mDNSResponder/mDNSCore/mDNS.c  | 33 ++
 mDNSResponder/mDNSCore/uDNS.c  | 18 
 mDNSResponder/mDNSCore/uDNS.h  |  2 ++
 mDNSResponder/mDNSShared/dns_sd.h  |  2 +-
 7 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/mDNSResponder/Makefile b/mDNSResponder/Makefile
index 8b97eacc..78adbd5e 100644
--- a/mDNSResponder/Makefile
+++ b/mDNSResponder/Makefile
@@ -17,7 +17,7 @@
 
 include $(MAKEFILEPATH)/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-878.230.2"
+MVERS = "mDNSResponder-878.240.1"
 
 VER =
 ifneq ($(strip $(GCC_VERSION)),)
diff --git a/mDNSResponder/mDNSCore/DNSCommon.c 
b/mDNSResponder/mDNSCore/DNSCommon.c
index a249b967..f3150762 100644
--- a/mDNSResponder/mDNSCore/DNSCommon.c
+++ b/mDNSResponder/mDNSCore/DNSCommon.c
@@ -3467,8 +3467,8 @@ mDNSexport const mDNSu8 *GetLargeResourceRecord(mDNS 
*const m, const DNSMessage
 rr->resrec.rrtype= (mDNSu16) ((mDNSu16)ptr[0] <<  8 | ptr[1]);
 rr->resrec.rrclass   = (mDNSu16)(((mDNSu16)ptr[2] <<  8 | ptr[3]) 
& kDNSClass_Mask);
 rr->resrec.rroriginalttl = (mDNSu32) ((mDNSu32)ptr[4] << 24 | 
(mDNSu32)ptr[5] << 16 | (mDNSu32)ptr[6] << 8 | ptr[7]);
-if (rr->resrec.rroriginalttl > 0x7000UL / mDNSPlatformOneSecond && 
(mDNSs32)rr->resrec.rroriginalttl != -1)
-rr->resrec.rroriginalttl = 0x7000UL / mDNSPlatformOneSecond;
+if (rr->resrec.rroriginalttl > mDNSMaximumTTLSeconds && 
(mDNSs32)rr->resrec.rroriginalttl != -1)
+rr->resrec.rroriginalttl = mDNSMaximumTTLSeconds;
 // Note: We don't have to adjust m->NextCacheCheck here -- this is just 
getting a record into memory for
 // us to look at. If we decide to copy it into the cache, then we'll 
update m->NextCacheCheck accordingly.
 pktrdlength   = (mDNSu16)((mDNSu16)ptr[8] <<  8 | ptr[9]);
diff --git a/mDNSResponder/mDNSCore/DNSCommon.h 
b/mDNSResponder/mDNSCore/DNSCommon.h
index b100a400..48dfe102 100644
--- a/mDNSResponder/mDNSCore/DNSCommon.h
+++ b/mDNSResponder/mDNSCore/DNSCommon.h
@@ -110,6 +110,13 @@ extern mDNSu32 mDNSRandom(mDNSu32 max); // Returns 
pseudo-random result from
 #define mDNSIsUpperCase(X) ((X) >= 'A' && (X) <= 'Z')
 #define mDNSIsLowerCase(X) ((X) >= 'a' && (X) <= 'z')
 #define mDNSIsLetter(X)(mDNSIsUpperCase(X) || mDNSIsLowerCase(X))
+
+// We believe we have adequate safeguards to protect against cache poisoning.
+// In the event that someone does find a workable cache poisoning attack, we 
want to limit the lifetime of the poisoned entry.
+// We set the maximum allowable TTL to one hour.
+// With the 25% correction factor to avoid the DNS Zeno's paradox bug, that 
gives us an actual maximum lifetime of 75 minutes.
+
+#define mDNSMaximumTTLSeconds (mDNSu32)3600
 
 #define mDNSValidHostChar(X, notfirst, notlast) (mDNSIsLetter(X) || 
mDNSIsDigit(X) || ((notfirst) && (notlast) && (X) == '-') )
 
diff --git a/mDNSResponder/mDNSCore/mDNS.c b/mDNSResponder/mDNSCore/mDNS.c
index 10504d09..9e1ac506 100755
--- a/mDNSResponder/mDNSCore/mDNS.c
+++ b/mDNSResponder/mDNSCore/mDNS.c
@@ -7171,7 +7171,7 @@ mDNSlocal mDNSu8 *GenerateUnicastResponse(const 
DNSMessage *const query, const m
 const mDNSu8*const limit = response->data + sizeof(response->data);
 const mDNSu8*ptr = query->data;
 AuthRecord  *rr;
-mDNSu32 maxttl = 0x7000;
+mDNSu32 maxttl = mDNSMaximumTTLSeconds;
 int i;
 
 // Initialize the response fields so we can answer the questions
@@ -8075,19 +8075,25 @@ struct UDPSocket_struct
 mDNSIPPort port; // MUST BE FIRST FIELD -- mDNSCoreReceive expects every 
UDPSocket_struct to begin with mDNSIPPort port
 };
 
-mDNSlocal DNSQuestion *ExpectingUnicastResponseForQuestion(const mDNS *const 
m, const mDNSIPPort port, const mDNSOpaque16 id, const DNSQuestion *const 
question, mDNSBool tcp)
+mDNSlocal DNSQuestion *ExpectingUnicastResponseForQuestion(const mDNS *const 
m, const mDNSIPPort port, const mDNSOpaque16 id, const DNSQuestion *const 
question, mDNSBool tcp, DNSQuestion ** suspiciousQ)
 {
 DNSQuestion *q;
 for (q = m->Questions; q; q=q->next)
 {
 if (!tcp && !q->LocalSocket) continue;
-if (mDNSSameIPPort(tcp ? q->tcpSrcPort : q->LocalSocket->port, port)   
  &&
-mDNSSameOpaque16(q->TargetQID, id)   &&
+if (mDNSSameIPPort(tcp ? q->tcpSrcPort : q->LocalSocket->port, port)   
&&
 q->qtype  == question->qtype &&
 q->qclass == question->qclass&&
 q->qnamehash  == question->qnamehash &&
 SameDomainName(&q->qname, &question->qname))
-retur

[PATCH 03/10] mDNSResponder: Update to v878.70.2

2020-06-19 Thread Sebastian Huber
The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.70.2.tar.gz

Update #4010.
---
 mDNSResponder/Makefile | 2 +-
 mDNSResponder/mDNSCore/DNSCommon.c | 6 --
 mDNSResponder/mDNSShared/dns_sd.h  | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/mDNSResponder/Makefile b/mDNSResponder/Makefile
index fa0a4e49..978c8953 100644
--- a/mDNSResponder/Makefile
+++ b/mDNSResponder/Makefile
@@ -16,7 +16,7 @@
 
 include $(MAKEFILEPATH)/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-878.50.17"
+MVERS = "mDNSResponder-878.70.2"
 
 VER =
 ifneq ($(strip $(GCC_VERSION)),)
diff --git a/mDNSResponder/mDNSCore/DNSCommon.c 
b/mDNSResponder/mDNSCore/DNSCommon.c
index 750c10e6..597c4cc0 100644
--- a/mDNSResponder/mDNSCore/DNSCommon.c
+++ b/mDNSResponder/mDNSCore/DNSCommon.c
@@ -2770,7 +2770,9 @@ mDNSexport const mDNSu8 *getDomainName(const DNSMessage 
*const msg, const mDNSu8
 
 case 0x80:  debugf("getDomainName: Illegal label length 0x%X in domain 
name %##s", len, name->c); return(mDNSNULL);
 
-case 0xC0:  offset = (mDNSu16)mDNSu16)(len & 0x3F)) << 8) | 
*ptr++);
+case 0xC0:  if (ptr >= end)
+{ debugf("getDomainName: Malformed compression label (overruns 
packet end)"); return(mDNSNULL); }
+offset = (mDNSu16)mDNSu16)(len & 0x3F)) << 8) | *ptr++);
 if (!nextbyte) nextbyte = ptr;  // Record where we got 
to before we started following pointers
 ptr = (mDNSu8 *)msg + offset;
 if (ptr < (mDNSu8*)msg || ptr >= end)
@@ -3335,7 +3337,7 @@ mDNSexport mDNSBool SetRData(const DNSMessage *const msg, 
const mDNSu8 *ptr, con
 AssignDomainName(&name, (domainname *)ptr);
 ptr += DomainNameLength(&name);
 }
-if (!ptr)
+if (!ptr || ptr >= end)
 {
 LogInfo("SetRData: Malformed name for TSIG/TKEY type %d", 
rr->resrec.rrtype);
 goto fail;
diff --git a/mDNSResponder/mDNSShared/dns_sd.h 
b/mDNSResponder/mDNSShared/dns_sd.h
index 94237fb3..0e5c35ee 100644
--- a/mDNSResponder/mDNSShared/dns_sd.h
+++ b/mDNSResponder/mDNSShared/dns_sd.h
@@ -66,7 +66,7 @@
  */
 
 #ifndef _DNS_SD_H
-#define _DNS_SD_H 8785017
+#define _DNS_SD_H 8787002
 
 #ifdef  __cplusplus
 extern "C" {
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 00/10] Update mDNSResponder to Apple v878.270.2

2020-06-19 Thread Sebastian Huber
This patch set applies to the master and 5-freebsd-12 branches of
libbsd.

Sebastian Huber (10):
  mDNSResponder: Back to mDNSResponder-878.30.4
  mDNSResponder: Update to v878.50.17
  mDNSResponder: Update to v878.70.2
  mDNSResponder: Update to v878.200.35
  mDNSResponder: Update to v878.230.2
  mDNSResponder: Update to v878.240.1
  mDNSResponder: Update to v878.250.4
  mDNSResponder: Update to v878.260.1
  mDNSResponder: Update to v878.270.2
  mDNSResponder: Port to RTEMS

 mDNSResponder/Clients/dns-sd.c|   107 +-
 mDNSResponder/Clients/dnssdutil.c | 20309 +---
 mDNSResponder/Makefile| 6 +-
 mDNSResponder/mDNSCore/DNSCommon.c|   389 +-
 mDNSResponder/mDNSCore/DNSCommon.h|13 +-
 mDNSResponder/mDNSCore/dnssec.c   | 2 +-
 mDNSResponder/mDNSCore/mDNS.c |   523 +-
 mDNSResponder/mDNSCore/mDNSDebug.h| 7 +-
 mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h  |85 +-
 mDNSResponder/mDNSCore/uDNS.c |   209 +-
 mDNSResponder/mDNSCore/uDNS.h | 2 +
 .../mDNSMacOSX/BATS/mDNSResponder.plist   |   627 +
 .../mDNSMacOSX/BonjourTop/source/BonjourTop.1 |   156 +-
 mDNSResponder/mDNSMacOSX/D2D.c|49 +-
 mDNSResponder/mDNSMacOSX/DNS64.c  |34 +-
 mDNSResponder/mDNSMacOSX/DNS64.h  | 4 +-
 .../mDNSMacOSX/DNSServiceDiscovery.c  |10 +-
 .../mDNSMacOSX/DNSServiceDiscovery.h  |15 +-
 mDNSResponder/mDNSMacOSX/LegacyNATTraversal.c | 3 +-
 .../com.apple.mDNSResponder.plist |14 +
 .../com.apple.mDNSResponder.plist |16 +
 mDNSResponder/mDNSMacOSX/Metrics.h| 2 +-
 mDNSResponder/mDNSMacOSX/Metrics.m|29 +-
 .../Private/com.apple.mDNSResponder.plist |19 -
 .../mDNSMacOSX/Scripts/bonjour-mcast-diagnose |   380 +
 .../Scripts/bonjour-start-mdns-tcpdump|56 +
 ...com.apple.mDNSResponder.mdns-tcpdump.plist |21 +
 mDNSResponder/mDNSMacOSX/daemon.c |27 +-
 .../mDNSMacOSX/dnssdutil-entitlements.plist   |12 +
 mDNSResponder/mDNSMacOSX/helper-stubs.c   |18 +-
 mDNSResponder/mDNSMacOSX/helper.c |15 +-
 mDNSResponder/mDNSMacOSX/mDNSMacOSX.c |   720 +-
 mDNSResponder/mDNSMacOSX/mDNSMacOSX.h |11 +-
 mDNSResponder/mDNSMacOSX/mDNSResponder.sb | 4 +-
 .../mDNSResponder.xcodeproj/project.pbxproj   |   193 +-
 .../mDNSMacOSX/uDNSPathEvalulation.c  | 8 +-
 mDNSResponder/mDNSPosix/ProxyResponder.c  | 2 +-
 mDNSResponder/mDNSPosix/Responder.c   | 2 +-
 mDNSResponder/mDNSPosix/mDNSPosix.c   | 5 +-
 mDNSResponder/mDNSPosix/mDNSUNP.c |60 +-
 mDNSResponder/mDNSPosix/mDNSUNP.h | 8 +-
 mDNSResponder/mDNSResponder.sln   |21 +
 mDNSResponder/mDNSShared/CommonServices.h | 6 +-
 mDNSResponder/mDNSShared/dns_sd.h |62 +-
 mDNSResponder/mDNSShared/dns_sd_private.h | 8 +-
 mDNSResponder/mDNSShared/dnsextd.c| 4 +-
 mDNSResponder/mDNSShared/dnsextd.conf |10 +-
 mDNSResponder/mDNSShared/dnssd_clientlib.c|16 +-
 mDNSResponder/mDNSShared/dnssd_clientshim.c   | 1 +
 mDNSResponder/mDNSShared/dnssd_clientstub.c   | 1 -
 mDNSResponder/mDNSShared/mDNSDebug.c  | 3 +-
 mDNSResponder/mDNSShared/uds_daemon.c |   116 +-
 .../mDNSWindows/BonjourQuickLooks.sln |   162 +-
 .../BonjourQuickLooksInstaller.wixproj|   170 +-
 mDNSResponder/mDNSWindows/mDNSWin32.c | 2 +-
 mDNSResponder/unittests/CNameRecordTests.c| 3 +-
 mDNSResponder/unittests/mDNSCoreReceiveTest.c |18 +-
 mDNSResponder/unittests/mdns_ut.c | 9 -
 mDNSResponder/unittests/uds_daemon_ut.c   | 2 +-
 mDNSResponder/unittests/unittest_common.h | 2 -
 testsuite/foobarserver/test_main.c| 2 +-
 61 files changed, 19922 insertions(+), 4868 deletions(-)
 create mode 100644 mDNSResponder/mDNSMacOSX/BATS/mDNSResponder.plist
 create mode 100644 
mDNSResponder/mDNSMacOSX/LoggingProfiles/AppleInternal/com.apple.mDNSResponder.plist
 create mode 100644 
mDNSResponder/mDNSMacOSX/LoggingProfiles/com.apple.mDNSResponder.plist
 delete mode 100644 
mDNSResponder/mDNSMacOSX/Private/com.apple.mDNSResponder.plist
 create mode 100755 mDNSResponder/mDNSMacOSX/Scripts/bonjour-mcast-diagnose
 create mode 100755 mDNSResponder/mDNSMacOSX/Scripts/bonjour-start-mdns-tcpdump
 create mode 100644 
mDNSResponder/mDNSMacOSX/Scripts/com.apple.mDNSResponder.mdns-tcpdump.plist
 create mode 100644 mDNSResponder/mDNSMacOSX/dnssdutil-entitlements.plist

-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 05/10] mDNSResponder: Update to v878.230.2

2020-06-19 Thread Sebastian Huber
The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.230.2.tar.gz

Update #4010.
---
 mDNSResponder/Makefile |  2 +-
 mDNSResponder/mDNSCore/mDNS.c  | 24 +++---
 mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h   |  5 +++--
 mDNSResponder/mDNSCore/uDNS.c  | 13 +++-
 mDNSResponder/mDNSMacOSX/daemon.c  |  3 ++-
 mDNSResponder/mDNSMacOSX/mDNSMacOSX.c  |  8 ++--
 mDNSResponder/mDNSMacOSX/mDNSMacOSX.h  |  1 +
 mDNSResponder/mDNSPosix/mDNSPosix.c|  2 +-
 mDNSResponder/mDNSShared/dns_sd.h  |  2 +-
 mDNSResponder/mDNSShared/dnsextd.c |  4 ++--
 mDNSResponder/mDNSWindows/mDNSWin32.c  |  2 +-
 mDNSResponder/unittests/CNameRecordTests.c |  3 ++-
 12 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/mDNSResponder/Makefile b/mDNSResponder/Makefile
index d50841c2..8b97eacc 100644
--- a/mDNSResponder/Makefile
+++ b/mDNSResponder/Makefile
@@ -17,7 +17,7 @@
 
 include $(MAKEFILEPATH)/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-878.200.35"
+MVERS = "mDNSResponder-878.230.2"
 
 VER =
 ifneq ($(strip $(GCC_VERSION)),)
diff --git a/mDNSResponder/mDNSCore/mDNS.c b/mDNSResponder/mDNSCore/mDNS.c
index 8deada2e..10504d09 100755
--- a/mDNSResponder/mDNSCore/mDNS.c
+++ b/mDNSResponder/mDNSCore/mDNS.c
@@ -9236,6 +9236,7 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
 {
 debugf("mDNSCoreReceiveResponse: InterfaceID %p %##s 
(%s)", q->InterfaceID, q->qname.c, DNSTypeName(q->qtype));
 m->rec.r.resrec.rDNSServer = uDNSServer = 
q->qDNSServer;
+if (!unicastQuestion) unicastQuestion = q;  //  
Acceptable responses to unicast questions need to have (unicastQuestion != nil)
 }
 else
 {
@@ -11302,6 +11303,8 @@ mDNSlocal mDNSBool IsPrivateDomain(mDNS *const m, 
DNSQuestion *q)
 }
 }
 
+#define TrueFalseStr(X) ((X) ? "true" : "false")
+
 // This function takes the DNSServer as a separate argument because sometimes 
the
 // caller has not yet assigned the DNSServer, but wants to evaluate the 
SuppressQuery
 // status before switching to it.
@@ -11328,13 +11331,20 @@ mDNSlocal mDNSBool ShouldSuppressUnicastQuery(mDNS 
*const m, DNSQuestion *q, DNS
 }
 
 // Check if the DNS Configuration allows A/ queries to be sent
-if ((q->qtype == kDNSType_A) && (d->req_A))
+if ((q->qtype == kDNSType_A) && d->req_A)
 {
-LogDebug("ShouldSuppressUnicastQuery: Query not suppressed for %##s, 
qtype %s, DNSServer %##s %#a:%d allows A queries", q->qname.c,
-DNSTypeName(q->qtype), d->domain.c, &d->addr, 
mDNSVal16(d->port));
-return mDNSfalse;
+// The server's configuration allows A record queries, so don't 
suppress this query unless
+// 1. the interface associated with the server is CLAT46; and
+// 2. the query has the kDNSServiceFlagsPathEvaluationDone flag, 
which indicates that it came from libnetcore.
+// See  for more info.
+if (!(d->isCLAT46 && (q->flags & kDNSServiceFlagsPathEvaluationDone)))
+{
+LogDebug("ShouldSuppressUnicastQuery: Query not suppressed for 
%##s, qtype %s, DNSServer %##s %#a:%d allows A queries", q->qname.c,
+ DNSTypeName(q->qtype), d->domain.c, &d->addr, 
mDNSVal16(d->port));
+return mDNSfalse;
+}
 }
-if ((q->qtype == kDNSType_) && (d->req_))
+if ((q->qtype == kDNSType_) && d->req_)
 {
 LogDebug("ShouldSuppressUnicastQuery: Query not suppressed for %##s, 
qtype %s, DNSServer %##s %#a:%d allows  queries", q->qname.c,
 DNSTypeName(q->qtype), d->domain.c, &d->addr, 
mDNSVal16(d->port));
@@ -11348,8 +11358,8 @@ mDNSlocal mDNSBool ShouldSuppressUnicastQuery(mDNS 
*const m, DNSQuestion *q, DNS
 }
 #endif
 
-LogInfo("ShouldSuppressUnicastQuery: Query suppressed for %##s, qtype %s, 
since DNS Configuration does not allow (req_A is %s and req_ is %s)",
-q->qname.c, DNSTypeName(q->qtype), d->req_A ? "true" : "false", 
d->req_ ? "true" : "false");
+LogInfo("ShouldSuppressUnicastQuery: Query suppressed for %##s, qtype %s, 
since DNS Configuration does not allow (req_A %s, req_ %s, CLAT46 %s)",
+q->qname.c, DNSTypeName(q->qtype), TrueFalseStr(d->req_A), 
TrueFalseStr(d->req_), TrueFalseStr(d->isCLAT46));
 
 return mDNStrue;
 }
diff --git a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h 
b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
index 511aa3b6..26c70089 100755
--- a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
+++ b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
@@ -1383,6 +1383,7 @@ typedef struct DNSServer
 mDNSBool req_DO;// If set, okay to send DNSSEC queries (EDNS 
DO bit is supported)
 mDNSBool DNSSECAware;   // Set if we are a

Re: [PATCH] APA definitions

2020-06-19 Thread Sebastian Huber

On 19/06/2020 11:51, Richi Dubey wrote:

Also writing 'qa' after visually selecting words by pressing v did not 
do anything. I also search the docs on 
http://vimdoc.sourceforge.net/htmldoc/editing.html but couldn't find 
anything. What is qa supposed to do? Is it related to formatting?


Sorry, it is "gq":

https://www.methods.co.nz/asciidoc/chunked/ch36.html

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] Adding APA terms to glossary

2020-06-19 Thread Sebastian Huber

Hello Richi,

thanks for the update, we are getting closer to the final version.

On 19/06/2020 11:49, Richi Dubey wrote:

---
  c-user/glossary.rst | 31 +++
  1 file changed, 31 insertions(+)

diff --git a/c-user/glossary.rst b/c-user/glossary.rst
index 86350a8..691ba52 100644
--- a/c-user/glossary.rst
+++ b/c-user/glossary.rst
@@ -1,5 +1,6 @@
  .. SPDX-License-Identifier: CC-BY-SA-4.0
  
+.. Copyright (C) 2020 Richi Dubey (richidu...@gmail.com)

  .. Copyright (C) 2017, 2019 embedded brains GmbH 
(http://www.embedded-brains.de)
  .. Copyright (C) 1988, 1998 On-Line Applications Research Corporation (OAR)
  
@@ -16,6 +17,13 @@ Glossary

  A term used to describe an object which has been created by an
  application.
  
+APA

+This term is an acronym for Arbitrary Processor Affinity.
+APA schedulers allow a thread to have an arbitrary affinity to
+a processor set, rather than a restricted mapping to only one
+processor of the set or the ability to run on all processors of
+the set. It has two variants, :term:`Weak APA` and :term:`Strong APA`
Looks good, except the missing dot to end the last sentence. Please try 
the vim "gq" to format the text.

+
  aperiodic task
  A task which must execute only at irregular intervals and has only a 
soft
  deadline.
@@ -777,6 +785,19 @@ Glossary
  :term:`return value` to indicate a successful operation or error
  conditions.
  
+Strong APA

+Strong APA is a specialization of :term:`APA`.
+Whenever a :term:`thread` becomes ready for execution, schedulers which
+implement strong APA recursively search for a processor in the thread's
+affinity set, followed by the processors in the affinity set of threads
+that are assigned the processor present in the ready thread's affinity 
set.
+This is done to find a thread to processor mapping that does not 
violate the
+priority ordering and to provide a schedule with a higher total 
priority of
Sorry for being pedantic, but please keep in mind that RTEMS users 
interested in this stuff may not have read many scheduler papers. They 
may ask what "a schedule" is.

+the threads scheduled.
+Similar analysis is done when a thread finishes its execution.

"finishes its execution" -> "blocks".

+
+See also :cite:`Cerqueira:2014:LPA`.
+
  suspend
  A term used to describe a task that is not competing for the CPU 
because it
  has had a ``rtems_task_suspend`` directive.
@@ -905,6 +926,16 @@ Glossary
  Message queues, regions, and semaphores have a wait queue associated 
with
  them.
  
+Weak APA

+Weak APA is a specialization of :term:`APA`. This refers to Linux's 
push and
+pull implementation of APA model. On the arrival of a thread,
Please avoid this "arrival", use a phrase like "Whenever a 
:term:`thread` becomes ready for execution" like above.

the thread is
+scheduled when a processor in its affinity set is idle or a processor 
in its
+affinity set is executing a thread which is at a lower priority.
+Unlike :term:`Strong APA`, no thread is migrated from its processor to 
find
+a thread to processor mapping.
+
+See also :cite:`Cerqueira:2014:LPA`.
+
  YAML
  This term is an acronym for `YAML Ain't Markup Language 
`_.
  

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Documentation of Qualification Toolchain?

2020-06-19 Thread Sebastian Huber

Hello,

the qualification toolchain in

https://git.rtems.org/sebh/rtems-qual.git/

needs a bit of documentation. For a start, I propose to add it to the 
RTEMS Software Engineering manual.


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: Multicast in Libbsd

2020-06-19 Thread Cedric Berger

On 18.06.20 22:47, Joel Sherrill wrote:


Hi

I have an example FACE application I am trying to port to RTEMS.  This 
is a multi-question email:


First, it fails with EADDRNOTAVAIL on this call:

         // Subscribe to multicast group
          struct ip_mreq mreq;
          rc = inet_pton(AF_INET, multicastGroup_m, 
&mreq.imr_multiaddr.s_addr);

          mreq.imr_interface.s_addr = htonl(INADDR_ANY);
          rc = setsockopt(
            new_socket,
            IPPROTO_IP,
            IP_ADD_MEMBERSHIP,
            &mreq,
            sizeof(mreq)
          );

I assume that is because there is no multicast route. On Linux, you 
have to do an ifconfig and route to have a multicast route, but I 
haven't been able to find a multicast setup example for FreeBSD. The 
Linux commands are:


    ifconfig lo multicast
    route add -net 224.0.0.0 netmask 240.0.0.0 dev lo


This:

https://gist.github.com/hostilefork/f7cae3dc33e7416f2dd25a402857b6c6

Compiles and run without any special configuration on FreeBSD 12.1

The handbook claims that "Multicast applications do not require any 
special configuration in order to run on FreeBSD"


https://www.freebsd.org/doc/handbook/network-routing.html

Following is the routing table on a FreeBSD jail with no special 224 
route needed.


Cédric

# netstat -nr
Routing tables

Internet:
Destination    Gateway    Flags Netif Expire
default    172.18.12.1    UGS    epair25b
127.0.0.1  link#1 UH  lo0
172.18.12.0/24 link#3 U  epair25b
172.18.12.25   link#3 UHS lo0

Internet6:
Destination   Gateway Flags Netif Expire
::/96 ::1 UGRS    lo0
::1   link#1 UH  lo0
:::0.0.0.0/96 ::1 UGRS    lo0
fe80::/10 ::1 UGRS    lo0
fe80::%lo0/64 link#1 U   lo0
fe80::1%lo0   link#1 UHS lo0
ff02::/16 ::1 UGRS    lo0


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Context switching for protected stacks

2020-06-19 Thread Gedare Bloom
You can start with the CPP macro you suggest, but eventually we probably
want to make all of this part of application configuration. It is probably
easier to develop using the macros, and then refactor later.

On Thu, Jun 18, 2020, 11:59 PM Utkarsh Rai  wrote:

>
>
> On Fri, Jun 19, 2020 at 3:04 AM Gedare Bloom  wrote:
>
>> On Thu, Jun 18, 2020 at 8:03 AM Utkarsh Rai 
>> wrote:
>> >
>> >
>> >
>> > On Thu, Jun 18, 2020 at 6:34 PM Gedare Bloom  wrote:
>> >>
>> >> On Wed, Jun 17, 2020 at 11:17 PM Utkarsh Rai 
>> wrote:
>> >> >
>> >> > Hello,
>> >> > For my GSoC project, I need to set/unset the memory attributes of
>> the thread stacks on each context switch.
>> >> > Right now I am making changes to the CPU-specific context switch
>> assembly code. The arm/../cpu.h file has the Context_Control structure,
>> which is used to store the relevant registers at each context switch.
>> >> >  I have been trying to add the stack attributes to this structure
>> from the 'rtems/score/stackmanagement.h' header (This header has been
>> defined by me and has the stack attributes structure).
>> >>
>> >> When you change the context structure, there might be other places you
>> >> need to update besides the context switch itself. One that comes to
>> >> mind is _CPU_Context_validate. Maybe chase down where the context is
>> >> referenced.
>> >>
>> >> >  After that, I would initialize the stack attributes in
>> _CPU_Context_Initialize.
>> >> >  For unsetting stack memories, I plan on making changes to
>> _CPU_Context_Switch().
>> >> > The problem is when I try to include the header in cpu.h it breaks
>> the build with the following error -
>> >> >
>> >> > '...
>> >> > 
>> >> >
>> /home/utkarsh/sandbox/rtems/5/arm-rtems5/include/machine/_default_types.h:
>> Assembler messages:
>> >> >
>> /home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:42:
>> Error: junk at end of line, first unrecognized character is `}'
>> >> >
>> /home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:44:
>> Error: bad instruction `typedef struct stack_attr_prot'
>> >> >
>> /home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:45:
>> Error: junk at end of line, first unrecognized character is `{'
>> >> >
>> /home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:46:
>> Error: bad instruction `stack_attr_shared *shared_stacks'
>> >> >
>> /home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:47:
>> Error: bad instruction `stack_attr Base'
>> >> >
>> /home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:48:
>> Error: bad instruction `_bool current_stack'
>> >> > {standard input}: Error: invalid operands (*UND* and *ABS* sections)
>> for `*' when setting `iter'
>> >> > Makefile:11563: recipe for target
>> 'score/cpu/arm/arm-context-validate.o' failed
>> >> > make[4]: *** [score/cpu/arm/arm-context-validate.o] Error 1
>> >> > '
>> >> > I have defined the stackmanagement.h header in the cpukit/headers.am
>> and this is obviously an assembler error.  Can someone point out what is it
>> that I am doing wrong?
>> >> >
>> >>
>> >> When a .h file can be included in both C and ASM, you need to separate
>> >> some of it, and disable some of it in ASM scope that doesn't
>> >> understand C data types. See, for example,
>> >> cpukit/include/rtems/score/percpu.h
>> >>
>>
>
> Thank you, this solves the problem.
>
>
>> >> > I also would like to verify if the above way of handling context
>> switching is the appropriate way to proceed.
>> >>
>> >> Seems like the right general idea. We probably need a CPP switch to
>> >> enable/disable this stuff though.
>> >
>> >
>> > Can you please elaborate on CPP switch? I am not sure if I am clear
>> about this.
>>
>> Yeah, my reply was a little short. CPP for C Preprocessor. A CPP
>> switch is used for conditional compilation of code, something like
>>
>> #if defined(USE_MMU)
>> ... /* some MMU related code */
>> #else
>> ... /* something without using MMU */
>> #endif
>>
>> This way high-level features can control which code gets compiled into
>> the binary image. This works pretty well for coarse-grained features.
>> It is not that useful for finer-grained features, like you might not
>> want to have USE_MMU_2K_PAGES and USE_MMU_4K_PAGES and
>> USE_MMU_4M_PAGES instead it would be better to have USE_MMU and within
>> that scope provide some way to distinguish the page sizes. I hope that
>> makes some sense.
>>
>> Another example is ASM. We have #if ASM to control whether a header
>> has been included in an assembler source file.
>>
>
> Thank you, this makes it clear. Also, if we are using CPP switches for
> switching to MMU related code, I wonder what should be the high-level
> configuration option that should be provided to the user. A very naive way
> can be if the user defines something like-
>  #define USE_THREAD_STACK_PROTECTION
>
> and then the places where we need to handle for thread stack protection we
> 

Re: Documentation of Qualification Toolchain?

2020-06-19 Thread Gedare Bloom
That seems like a good place for it.

On Fri, Jun 19, 2020, 7:38 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Hello,
>
> the qualification toolchain in
>
> https://git.rtems.org/sebh/rtems-qual.git/
>
> needs a bit of documentation. For a start, I propose to add it to the
> RTEMS Software Engineering manual.
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Multicast in Libbsd

2020-06-19 Thread Heinz Junkes
I can agree with Cedric.

I use rtems5 with rtems-libbsd. I initialize the network interfaces of my 
target via dhcpcd 
and the interfaces are automatically multicast capable.

This works without creating a route:

 if (setsockopt(conf->udp, IPPROTO_IP, IP_ADD_MEMBERSHIP,
(char *) &mreq, sizeof(mreq))!=0) {
struct sockaddr_in temp;
char name[40];
...

Heinz


> On 19. Jun 2020, at 17:53, Cedric Berger  wrote:
> 
> On 18.06.20 22:47, Joel Sherrill wrote:
> 
>> Hi
>> 
>> I have an example FACE application I am trying to port to RTEMS.  This is a 
>> multi-question email:
>> 
>> First, it fails with EADDRNOTAVAIL on this call:
>> 
>>  // Subscribe to multicast group
>>   struct ip_mreq mreq;
>>   rc = inet_pton(AF_INET, multicastGroup_m, 
>> &mreq.imr_multiaddr.s_addr);
>>   mreq.imr_interface.s_addr = htonl(INADDR_ANY);
>>   rc = setsockopt(
>> new_socket, 
>> IPPROTO_IP, 
>> IP_ADD_MEMBERSHIP, 
>> &mreq, 
>> sizeof(mreq)
>>   );
>> 
>> I assume that is because there is no multicast route. On Linux, you have to 
>> do an ifconfig and route to have a multicast route, but I haven't been able 
>> to find a multicast setup example for FreeBSD. The Linux commands are:
>> 
>> ifconfig lo multicast
>> route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
> This:
> 
> https://gist.github.com/hostilefork/f7cae3dc33e7416f2dd25a402857b6c6
> 
> Compiles and run without any special configuration on FreeBSD 12.1
> 
> The handbook claims that "Multicast applications do not require any special 
> configuration in order to run on FreeBSD"
> 
> https://www.freebsd.org/doc/handbook/network-routing.html
> 
> Following is the routing table on a FreeBSD jail with no special 224 route 
> needed.
> 
> Cédric
> 
> # netstat -nr
> Routing tables
> 
> Internet:
> DestinationGatewayFlags Netif Expire
> default172.18.12.1UGSepair25b
> 127.0.0.1  link#1 UH  lo0
> 172.18.12.0/24 link#3 U  epair25b
> 172.18.12.25   link#3 UHS lo0
> 
> Internet6:
> Destination   Gateway   Flags 
> Netif Expire
> ::/96 ::1   UGRS
> lo0
> ::1   link#1UH  
> lo0
> :::0.0.0.0/96 ::1   UGRS
> lo0
> fe80::/10 ::1   UGRS
> lo0
> fe80::%lo0/64 link#1U   
> lo0
> fe80::1%lo0   link#1UHS 
> lo0
> ff02::/16 ::1   UGRS
> lo0
> 
> 
> 
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



smime.p7s
Description: S/MIME cryptographic signature
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Multicast in Libbsd

2020-06-19 Thread Joel Sherrill
This turned out to be a trivial problem but hard to figure out. :(

The code has a POSIX_Init which initializes the stack and then calls the
application's main() which spawns a number of threads which start using the
stack. I disabled the POSIX_Init from calling main(), added mcast-listener
and mcast-writer (standard net code I had) as shell programs, and then
telnet'ed into the target. I could telnet in twice and run a listener in
one session and a writer in another. This proved that multicast was working
and made me wonder if there was a race condition on stack initialization
since it takes a little while to login twice and run two programs.

I put a sleep(10) before calling main() and the program came up. Based on
its output, it got through initialization but then faulted. I tracked that
down to RTEMS implementation of posix_devctl() being correct and the
adapter being used on Linux was incorrect.

*** Is there a reliable way to know the stack is settled out before the
application can run?

*** I still have to get the multicast out of qemu but that's another issue.

Thanks for the suggestions everyone.

--joel


On Fri, Jun 19, 2020 at 2:35 PM Heinz Junkes 
wrote:

> I can agree with Cedric.
>
> I use rtems5 with rtems-libbsd. I initialize the network interfaces of my
> target via dhcpcd
> and the interfaces are automatically multicast capable.
>
> This works without creating a route:
>
>  if (setsockopt(conf->udp, IPPROTO_IP, IP_ADD_MEMBERSHIP,
> (char *) &mreq, sizeof(mreq))!=0) {
> struct sockaddr_in temp;
> char name[40];
> ...
>
> Heinz
>
>
> > On 19. Jun 2020, at 17:53, Cedric Berger  wrote:
> >
> > On 18.06.20 22:47, Joel Sherrill wrote:
> >
> >> Hi
> >>
> >> I have an example FACE application I am trying to port to RTEMS.  This
> is a multi-question email:
> >>
> >> First, it fails with EADDRNOTAVAIL on this call:
> >>
> >>  // Subscribe to multicast group
> >>   struct ip_mreq mreq;
> >>   rc = inet_pton(AF_INET, multicastGroup_m,
> &mreq.imr_multiaddr.s_addr);
> >>   mreq.imr_interface.s_addr = htonl(INADDR_ANY);
> >>   rc = setsockopt(
> >> new_socket,
> >> IPPROTO_IP,
> >> IP_ADD_MEMBERSHIP,
> >> &mreq,
> >> sizeof(mreq)
> >>   );
> >>
> >> I assume that is because there is no multicast route. On Linux, you
> have to do an ifconfig and route to have a multicast route, but I haven't
> been able to find a multicast setup example for FreeBSD. The Linux commands
> are:
> >>
> >> ifconfig lo multicast
> >> route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
> > This:
> >
> > https://gist.github.com/hostilefork/f7cae3dc33e7416f2dd25a402857b6c6
> >
> > Compiles and run without any special configuration on FreeBSD 12.1
> >
> > The handbook claims that "Multicast applications do not require any
> special configuration in order to run on FreeBSD"
> >
> > https://www.freebsd.org/doc/handbook/network-routing.html
> >
> > Following is the routing table on a FreeBSD jail with no special 224
> route needed.
> >
> > Cédric
> >
> > # netstat -nr
> > Routing tables
> >
> > Internet:
> > DestinationGatewayFlags Netif Expire
> > default172.18.12.1UGSepair25b
> > 127.0.0.1  link#1 UH  lo0
> > 172.18.12.0/24 link#3 U  epair25b
> > 172.18.12.25   link#3 UHS lo0
> >
> > Internet6:
> > Destination   Gateway   Flags
>  Netif Expire
> > ::/96 ::1   UGRS
> lo0
> > ::1   link#1UH
> lo0
> > :::0.0.0.0/96 ::1   UGRS
> lo0
> > fe80::/10 ::1   UGRS
> lo0
> > fe80::%lo0/64 link#1U
>lo0
> > fe80::1%lo0   link#1UHS
>lo0
> > ff02::/16 ::1   UGRS
> lo0
> >
> >
> >
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: GSoC 2020: Weekly Progress Update

2020-06-19 Thread Mritunjay Sharma
On Fri, Jun 19, 2020 at 11:45 AM Chris Johns  wrote:

> On 17/6/20 3:11 pm, Mritunjay Sharma wrote:
> > Hello everyone,
> >
> > Following up as decided to update the weekly progress report on irc
> > channel on every Wednesday, I am updating the progress on the mailing
> list as well.
>
> Thank you for this. I cannot make IRC on a regular basis and email is best
> for
> me. Please keep the posts coming.
>
> >
> > ==Previous Work==
> >
> > Trying to fix missing files like "install/sh" error
> > to make the ptpd build run.
> >
> > ==Progress==
> >
> > Earlier errors have been resolved but a new one popped up in the morning.
> >
> > Modified source-builder/config/ptpd-2-1.cfg file again,
> > after Googling a little and following Heinz advice,
> >
> > %source setup ptpd -q -n ptpd-%{ptpd_version}
> > %patch setup ptpd -p1
> >
> >
> > +autoreconf -vfi
>
> This is causing me problems. I wonder why. I get ...
>
> configure.ac:27: error: possibly undefined macro: AC_PROG_LIBTOOL
>
> I will take a look at the release tarballs  tt looks like the release
> tarballs do not have generated autoconf files. Hmmm.
> > +automake --add-missing
> >
> > cd ${build_top}
> >
> > %build
> >
> > After this I made the local ptpd-master again a tar ball and used it,
> > which fixed the earlier, but now another error has popped up which I
> > am trying to fix.
> >
> > The error is as follows:
> >
> "/home/mritunjay/development/rtems/rsb/rtems/build/ptpd-master-arm-rtems5-1/do-build:
> > 155:
> >
> /home/mritunjay/development/rtems/rsb/rtems/build/ptpd-master-arm-rtems5-1/do-build:
> > ../ptpd-master/configure: not found
> > shell cmd failed: /bin/sh -ex
> >
>  
> /home/mritunjay/development/rtems/rsb/rtems/build/ptpd-master-arm-rtems5-1/do-build
> > error: building ptpd-master-arm-rtems5-1
> >   See error report: rsb-report-ptpd-master-arm-rtems5-1.txt
> > Build Set: Time 0:00:00.191542"
> >
> > ==Blockers==
> >
> > These configure errors are the main blockers.
> >
> > ==Future options==
> >
> > Looking forward to raise this with the ptpd community
> > and trying with the help of mentors to fix the problems
> > as soon as possible.
>
> I think we are wedged. For us to build a package for RTEMS we need access
> the
> RTEMS tools built by the RSB. Building these tools also builds a version of
> autoconf and automake we need to configure RTEMS. With the path set to
> include
> the RTEMS tools and so the RTEMS built autoconf and automake the PTPD
> INSTALL
> documented step of `autoreconf -vi` fails with the error above.
>
> I decided to test by hand using the following steps:
>
>  wget https://github.com/ptpd/ptpd/archive/ptpd.2.3.1.tar.gz
>  tar zxf ptpd.2.3.1.tar.gz
>  cd ptpd-ptpd.2.3.1
>  autoreconf -vi
>
> The generate has no isssue.
>
> I then added the RTEMS tools path back into my path. I also have the
> Xilinx Zynq
> QEMU BSP installed under my prefix so I entered ...
>
> LIBS="-lrtemsdefaultconfig"
> CFLAGS="-I/opt/work/rtems/5/arm-rtems5/xilinx_zynq_a9_qemu/lib/include
> -qrtems
> -B/opt/work/rtems/5/arm-rtems5/lib/
> -B/opt/work/rtems/5/arm-rtems5/xilinx_zynq_a9_qemu/lib/ --specs bsp_specs
> -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9 -O0 -g
> -ffunction-sections -fdata-sections" ./configure --host=arm-rtems5
> --disable-snmp --enable-slave-only --disable-pcap
>
> The configure completed without error. I do not think there is any point
> contacting the ptpd community just yet.
>
> The build however failed with ..
>
> ptpd.h:93:10: fatal error: netinet/ip.h: No such file or directory
>
> I suggest you step back from the RSB and build ptpd by hand. I have not
> looked
> into what is wrong and why I get this compile error.
>

Okay Chris, thank you for this suggestion, I will work on this and update
you.
I can tell you that I encountered the same error when I was building ptpd
with erc32 using RSB and then I was asked to add a different package that
contains netinet/ip.h and then build it first. I will get to you more on
this error
because I have worked on it earlier however while building it configure
errors
again started playing their tricks and when I started doing it with
xilinx_zynq_a9_qemu using RSB,
 it never came but the errors as mentioned earlier came up.

Mritunjay

>
> Chris
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: I want port rtems to a Cortex_R5 CPU

2020-06-19 Thread Joel Sherrill
On Thu, Jun 18, 2020 at 8:23 PM yuan...@aliyun.com 
wrote:

> Does rtems support this cpu? The arch is ARM v7r.
>

There is a BSP for the TI tms570 (rtems/bsps/arm/tms570) which should be an
r5 similar to what you are targeting.


> Another question is when the 5.1 edition will be released? Thank you very
> much!
>

I'd like to say yesterday, last week, last month, ... but there is at least
one issue to close before it is final I think.

And there was a report of the Pi2 not working with SMP which is troubling.

--joel


>
> --
> yuan...@aliyun.com
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Re: I want port rtems to a Cortex_R5 CPU

2020-06-19 Thread yuan...@aliyun.com
Thank you very much! I will try the tms570 bsp.



yuan...@aliyun.com
 
From: Joel Sherrill
Date: 2020-06-20 06:02
To: yuan...@aliyun.com
CC: devel
Subject: Re: I want port rtems to a Cortex_R5 CPU


On Thu, Jun 18, 2020 at 8:23 PM yuan...@aliyun.com  wrote:
Does rtems support this cpu? The arch is ARM v7r.

There is a BSP for the TI tms570 (rtems/bsps/arm/tms570) which should be an r5 
similar to what you are targeting.
 
Another question is when the 5.1 edition will be released? Thank you very much!

I'd like to say yesterday, last week, last month, ... but there is at least one 
issue to close before it is final I think.

And there was a report of the Pi2 not working with SMP which is troubling.

--joel
 



yuan...@aliyun.com
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel