lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Raw Ethernet II frames for PTP


From: address@hidden
Subject: Re: [lwip-users] Raw Ethernet II frames for PTP
Date: Thu, 25 Jul 2019 22:29:37 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Am 25.07.2019 um 21:22 schrieb Nathan Immerman via lwip-users:
Hi all,

I am implementing a software Precision Time Protocol (PTP)
implementation which requires reading Raw Ethernet II frames, no
TCP/IP/UDP. An example packet is copied below. Is this possible using lwIP?

Yes and no. There's no API for raw Ethernet frames in lwIP, but if
you're using it on an embedded system where you have access to the netif
driver, you can just send those frames directly to the netif driver's
linkoutput function.


I see the raw_new api accepts a proto parameter but there doesn't seem
to be a protocal define for raw frames.

The 'raw' API is for 'raw' transport layer access. IPv4 or IPv6 is
always encapsuled. This resembles the socket API. E.g. if you want to
send raw Ethernet frames in Linux, you need AF_PACKET, not SOCK_RAW.

I'd be open for a patch to include such raw (Ethernet) access if it's
done cleanly enough. AF_PACKET could be implemented above that as well.
I'm just not taking the time to do that myself...

Regards,
Simon


Protocols defined in ip.h
#define IP_PROTO_ICMP    1
#define IP_PROTO_IGMP    2
#define IP_PROTO_UDP     17
#define IP_PROTO_UDPLITE 136
#define IP_PROTO_TCP     6

Thank you.

Example PTP Raw Ethernet II frame copied from Wireshark

Frame 28: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
     Encapsulation type: Ethernet (1)
     Arrival Time: Jul 24, 2019 16:29:02.184864000 PDT
     [Time shift for this packet: 0.000000000 seconds]
     Epoch Time: 1564010942.184864000 seconds
     [Time delta from previous captured frame: 0.008057000 seconds]
     [Time delta from previous displayed frame: 0.008057000 seconds]
     [Time since reference or first frame: 0.264827000 seconds]
     Frame Number: 28
     Frame Length: 60 bytes (480 bits)
     Capture Length: 60 bytes (480 bits)
     [Frame is marked: False]
     [Frame is ignored: False]
     [Protocols in frame: eth:ethertype:ptp]
     [Coloring Rule Name: Broadcast]
     [Coloring Rule String: eth[0] & 1]
Ethernet II, Src: Trimble_70:09:90 (00:17:47:70:09:90), Dst:
IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
     Destination: IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
         Address: IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
         .... ..0. .... .... .... .... = LG bit: Globally unique address
(factory default)
         .... ...1 .... .... .... .... = IG bit: Group address
(multicast/broadcast)
     Source: Trimble_70:09:90 (00:17:47:70:09:90)
         Address: Trimble_70:09:90 (00:17:47:70:09:90)
         .... ..0. .... .... .... .... = LG bit: Globally unique address
(factory default)
         .... ...0 .... .... .... .... = IG bit: Individual address
(unicast)
     Type: PTPv2 over Ethernet (IEEE1588) (0x88f7)
     Padding: 0000
Precision Time Protocol (IEEE1588)
     0000 .... = transportSpecific: 0x0
     .... 0000 = messageId: Sync Message (0x0)
     .... 0010 = versionPTP: 2
     messageLength: 44
     subdomainNumber: 24
     flags: 0x0000
         0... .... .... .... = PTP_SECURITY: False
         .0.. .... .... .... = PTP profile Specific 2: False
         ..0. .... .... .... = PTP profile Specific 1: False
         .... .0.. .... .... = PTP_UNICAST: False
         .... ..0. .... .... = PTP_TWO_STEP: False
         .... ...0 .... .... = PTP_ALTERNATE_MASTER: False
         .... .... ..0. .... = FREQUENCY_TRACEABLE: False
         .... .... ...0 .... = TIME_TRACEABLE: False
         .... .... .... 0... = PTP_TIMESCALE: False
         .... .... .... .0.. = PTP_UTC_REASONABLE: False
         .... .... .... ..0. = PTP_LI_59: False
         .... .... .... ...0 = PTP_LI_61: False
     correction: 582.000015 nanoseconds
         correction: Ns: 582 nanoseconds
         correctionSubNs: 1.52587890625e-05 nanoseconds
     ClockIdentity: 0x001747fffe700990
     SourcePortID: 1
     sequenceId: 9796
     control: Sync Message (0)
     logMessagePeriod: -4
     originTimestamp (seconds): 1564010979
     originTimestamp (nanoseconds): 187716775

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]