Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package clknetsim for openSUSE:Factory checked in at 2026-08-22 21:35:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/clknetsim (Old) and /work/SRC/openSUSE:Factory/.clknetsim.new.1258 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "clknetsim" Sat Aug 22 21:35:35 2026 rev:9 rq:1373014 version:0+git.20260819 Changes: -------- --- /work/SRC/openSUSE:Factory/clknetsim/clknetsim.changes 2026-05-23 23:26:50.767410911 +0200 +++ /work/SRC/openSUSE:Factory/.clknetsim.new.1258/clknetsim.changes 2026-08-22 21:37:43.107597779 +0200 @@ -1,0 +2,11 @@ +Sat Aug 22 08:15:30 UTC 2026 - Martin Pluskal <[email protected]> + +- Update to version 0+git.20260819: + * Add minimal raw-socket support for ptp4l L2 transport + * Fix delay of raw packets + * Drop leftover TCP packets from an early-closed connection + * Allow TCP packets to be dropped by a negative delay + * Fix compilation in older C++ standard +- Pin obs_scm revision for reproducible snapshots + +------------------------------------------------------------------- Old: ---- clknetsim-0+git.20260512.obscpio New: ---- clknetsim-0+git.20260819.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ clknetsim.spec ++++++ --- /var/tmp/diff_new_pack.nbnbSu/_old 2026-08-22 21:37:43.756620979 +0200 +++ /var/tmp/diff_new_pack.nbnbSu/_new 2026-08-22 21:37:43.758621050 +0200 @@ -17,7 +17,7 @@ Name: clknetsim -Version: 0+git.20260512 +Version: 0+git.20260819 Release: 0 Summary: Clock and Network Simulator License: GPL-2.0-only ++++++ _service ++++++ --- /var/tmp/diff_new_pack.nbnbSu/_old 2026-08-22 21:37:43.792622266 +0200 +++ /var/tmp/diff_new_pack.nbnbSu/_new 2026-08-22 21:37:43.796622409 +0200 @@ -2,6 +2,7 @@ <service mode="manual" name="obs_scm"> <param name="url">https://github.com/mlichvar/clknetsim.git</param> <param name="scm">git</param> + <param name="revision">56b60ef2e807bb8b62ce0741cbaa3875f8a58885</param> <param name="changesgenerate">enable</param> <param name="filename">clknetsim</param> <param name="versionformat">0+git.%cd</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.nbnbSu/_old 2026-08-22 21:37:43.818623195 +0200 +++ /var/tmp/diff_new_pack.nbnbSu/_new 2026-08-22 21:37:43.822623338 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/mlichvar/clknetsim.git</param> - <param name="changesrevision">fcd076b8ffb1536820d9c4e9ef58ffd7a124325b</param></service></servicedata> + <param name="changesrevision">56b60ef2e807bb8b62ce0741cbaa3875f8a58885</param></service></servicedata> (No newline at EOF) ++++++ clknetsim-0+git.20260512.obscpio -> clknetsim-0+git.20260819.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-0+git.20260512/client.c new/clknetsim-0+git.20260819/client.c --- old/clknetsim-0+git.20260512/client.c 2026-05-12 11:54:12.000000000 +0200 +++ new/clknetsim-0+git.20260819/client.c 2026-08-19 14:10:52.000000000 +0200 @@ -50,6 +50,7 @@ #include <sys/ioctl.h> #include <net/if.h> #include <netdb.h> +#include <netpacket/packet.h> #include <pwd.h> #include <stdarg.h> #include <signal.h> @@ -84,6 +85,7 @@ #define NODE_FROM_SIN6(sin6) ((sin6)->sin6_addr.s6_addr[15]) #define SUBNET_FROM_SIN6(sin6) ((sin6)->sin6_addr.s6_addr[14]) #define ADDR_FROM_SIN6(sin6) (BASE_ADDR + (SUBNET_FROM_SIN6(sin6) << 8) + NODE_FROM_SIN6(sin6)) +#define IS_MAC_MCAST(a) (((char *)(a))[0] & 1) #define PTP_PRIMARY_MCAST_ADDR 0xe0000181 /* 224.0.1.129 */ #define PTP_PDELAY_MCAST_ADDR 0xe000006b /* 224.0.0.107 */ @@ -108,6 +110,7 @@ #define MAX_SOCKETS 20 #define BASE_SOCKET_FD 100 #define BASE_SOCKET_DEFAULT_PORT 60000 +#define BASE_SOCKET_RAW_PORT 61000 #define MAX_TIMERS 80 #define BASE_TIMER_ID 0xC1230123 @@ -921,6 +924,10 @@ sockets[i].listening || !sockets[i].connected) continue; break; + case MSG_TYPE_RAW_DATA: + if (sockets[i].type != SOCK_RAW) + continue; + break; default: assert(0); } @@ -935,6 +942,24 @@ return s; } +static int get_free_raw_port(void) { + int i, p; + + for (p = BASE_SOCKET_RAW_PORT; p < BASE_SOCKET_RAW_PORT + MAX_SOCKETS; p++) { + for (i = 0; i < MAX_SOCKETS; i++) { + if (!sockets[i].used || sockets[i].domain != AF_PACKET) + continue; + if (sockets[i].port == p) + break; + } + if (i == MAX_SOCKETS) + return p; + } + + assert(0); + return 0; +} + static void send_msg_to_peer(int s, int type) { struct Request_send req; @@ -1097,6 +1122,13 @@ ip_header_len = ip_family == 6 ? 40 : 20; + if (type == SOCK_RAW) { + if (data_len > buf_len) + return 0; + memcpy(frame, data, data_len); + return data_len; + } + assert(type == SOCK_DGRAM || type == SOCK_STREAM); if ((type == SOCK_DGRAM && data_len + 14 + ip_header_len + 8 > buf_len) || @@ -1932,10 +1964,11 @@ int socket(int domain, int type, int protocol) { int s; - if (((domain != AF_INET || ip_family == 6) && - (domain != AF_INET6 || ip_family == 4) && - (domain != AF_UNIX || unix_subnet < 0)) || - (type != SOCK_DGRAM && type != SOCK_STREAM)) { + if ((((domain != AF_INET || ip_family == 6) && + (domain != AF_INET6 || ip_family == 4) && + (domain != AF_UNIX || unix_subnet < 0)) || + (type != SOCK_DGRAM && type != SOCK_STREAM)) && + (domain != AF_PACKET || type != SOCK_RAW)) { errno = EINVAL; return -1; } @@ -1950,11 +1983,28 @@ sockets[s].used = 1; sockets[s].domain = domain; sockets[s].type = type; - sockets[s].port = BASE_SOCKET_DEFAULT_PORT + s; - sockets[s].iface = domain == AF_UNIX ? IFACE_UNIX : IFACE_ALL; sockets[s].remote_node = -1; sockets[s].remote_port = -1; + switch (domain) { + case AF_INET: + case AF_INET6: + sockets[s].port = BASE_SOCKET_DEFAULT_PORT + s; + sockets[s].iface = IFACE_ALL; + break; + case AF_UNIX: + sockets[s].port = BASE_SOCKET_DEFAULT_PORT + s; + sockets[s].iface = IFACE_UNIX; + break; + case AF_PACKET: + /* ports are given by the order of raw sockets */ + sockets[s].port = get_free_raw_port(); + sockets[s].iface = IFACE_ALL; + break; + default: + assert(0); + } + return get_socket_fd(s); } @@ -2075,6 +2125,7 @@ int s = get_socket_from_fd(sockfd), port; struct sockaddr_in6 *sin6; struct sockaddr_in *sin; + struct sockaddr_ll *sll; uint32_t a; static int unix_sockets = 0; @@ -2131,6 +2182,16 @@ sockets[s].iface = IFACE_ETH0 + subnet; } break; + case AF_PACKET: + assert(addrlen >= sizeof (*sll)); + sll = (struct sockaddr_ll *)addr; + assert(sll->sll_family == AF_PACKET); + assert(sll->sll_protocol == htons(ETH_P_ALL)); + assert(sll->sll_ifindex >= 1); + assert(sockets[s].iface == IFACE_ALL || + sockets[s].iface == sll->sll_ifindex + IFACE_ETH0 - 1); + sockets[s].iface = sll->sll_ifindex + IFACE_ETH0 - 1; + break; case AF_UNIX: assert(addrlen > offsetof(struct sockaddr_un, sun_path) + 1); @@ -2190,7 +2251,8 @@ int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen) { int subnet, s = get_socket_from_fd(sockfd); - if (s < 0 || (sockets[s].domain != AF_INET && sockets[s].domain != AF_INET6)) { + if (s < 0 || (sockets[s].domain != AF_INET && sockets[s].domain != AF_INET6 && + sockets[s].domain != AF_PACKET)) { errno = EINVAL; return -1; } @@ -2205,7 +2267,8 @@ return -1; } } - else if (optlen == sizeof (int) && ((level == IPPROTO_IP && optname == IP_PKTINFO) || + else if (sockets[s].domain != AF_PACKET && + optlen == sizeof (int) && ((level == IPPROTO_IP && optname == IP_PKTINFO) || (level == IPPROTO_IPV6 && optname == IPV6_RECVPKTINFO))) sockets[s].pkt_info = !!(int *)optval; #ifdef SO_TIMESTAMPING @@ -2700,6 +2763,15 @@ return -1; } break; + case AF_PACKET: + assert(!msg->msg_name); + assert(msg->msg_iov[0].iov_len >= 14); + assert(IS_MAC_MCAST(msg->msg_iov[0].iov_base)); + assert(sockets[s].iface >= IFACE_ETH0); + req.subnet = sockets[s].iface - IFACE_ETH0; + req.to = -1; + req.dst_port = sockets[s].port; + break; case AF_UNIX: sun = msg->msg_name; assert(sun && msg->msg_namelen > offsetof(struct sockaddr_un, sun_path) + 1); @@ -2725,6 +2797,9 @@ assert(sockets[s].connected); req.type = MSG_TYPE_TCP_DATA; break; + case SOCK_RAW: + req.type = MSG_TYPE_RAW_DATA; + break; default: assert(0); } @@ -2858,8 +2933,16 @@ msg->msg_flags = MSG_ERRQUEUE; - assert(sockets[s].type == SOCK_DGRAM); - rep.type = MSG_TYPE_UDP_DATA; + switch (sockets[s].type) { + case SOCK_DGRAM: + rep.type = MSG_TYPE_UDP_DATA; + break; + case SOCK_RAW: + rep.type = MSG_TYPE_RAW_DATA; + break; + default: + assert(0); + } rep.subnet = last_ts_msg->subnet; rep.from = last_ts_msg->to_from; rep.src_port = last_ts_msg->port; @@ -2882,6 +2965,9 @@ case SOCK_DGRAM: rep.type = MSG_TYPE_UDP_DATA; break; + case SOCK_RAW: + rep.type = MSG_TYPE_RAW_DATA; + break; default: assert(0); } @@ -2921,6 +3007,9 @@ sockets[s].connected = 0; } break; + case MSG_TYPE_RAW_DATA: + assert(sockets[s].type == SOCK_RAW); + break; default: assert(0); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-0+git.20260512/network.cc new/clknetsim-0+git.20260819/network.cc --- old/clknetsim-0+git.20260512/network.cc 2026-05-12 11:54:12.000000000 +0200 +++ new/clknetsim-0+git.20260819/network.cc 2026-08-19 14:10:52.000000000 +0200 @@ -441,10 +441,7 @@ i = packet->from * nodes.size() + packet->to; - if (packet->type != MSG_TYPE_UDP_DATA) { - /* constant delay to not break the order of TCP packets */ - delay = 1.0e-3; - } else if (link_delays[i]) { + if (link_delays[i]) { link_delay_variables["time"] = time; link_delay_variables["from"] = packet->from + 1; link_delay_variables["to"] = packet->to + 1; @@ -455,6 +452,12 @@ delay = link_delays[i]->generate(&link_delay_variables); } + if (delay > 0.0 && (packet->type >= MSG_TYPE_TCP_CONNECT && + packet->type <= MSG_TYPE_TCP_DISCONNECT)) { + /* constant delay to not break the order of TCP packets */ + delay = 1.0e-3; + } + if (delay > 0.0 && link_corrections[i]) { link_correction_variables["delay"] = delay; link_correction_variables["length"] = packet->len; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-0+git.20260512/network.h new/clknetsim-0+git.20260819/network.h --- old/clknetsim-0+git.20260512/network.h 2026-05-12 11:54:12.000000000 +0200 +++ new/clknetsim-0+git.20260819/network.h 2026-08-19 14:10:52.000000000 +0200 @@ -62,7 +62,7 @@ vector<Node *> nodes; vector<Generator *> link_delays; vector<Generator *> link_corrections; - vector<vector<Stats>> stats; + vector<vector<Stats> > stats; Generator_variables link_delay_variables; Generator_variables link_correction_variables; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-0+git.20260512/node.cc new/clknetsim-0+git.20260819/node.cc --- old/clknetsim-0+git.20260512/node.cc 2026-05-12 11:54:12.000000000 +0200 +++ new/clknetsim-0+git.20260819/node.cc 2026-08-19 14:10:52.000000000 +0200 @@ -20,6 +20,23 @@ #include "protocol.h" #include "sysheaders.h" +void Node::drop_stale_packets() { + struct Packet *packet; + + while (!incoming_packets.empty()) { + packet = incoming_packets.back(); + if (packet->type < MSG_TYPE_TCP_CONNECT || + packet->type > MSG_TYPE_TCP_DISCONNECT || + packet->receive_time + 0.1 > network->get_time()) + break; + delete packet; + incoming_packets.pop_back(); +#ifdef DEBUG + printf("dropped stale packet in %d at %f\n", index, clocks[0].get_real_time()); +#endif + } +} + Node::Node(int index, int node_clocks, Network *network) { this->clocks.resize(node_clocks); this->refclock_base = NULL; @@ -187,6 +204,8 @@ void Node::try_select() { Reply_select rep = {-1, 0, 0}; + drop_stale_packets(); + if (terminate) { rep.ret = REPLY_SELECT_TERMINATE; #ifdef DEBUG @@ -259,6 +278,8 @@ Reply_recv rep; struct Packet *packet; + drop_stale_packets(); + if (incoming_packets.empty()) { rep.type = MSG_TYPE_NO_MSG; rep.subnet = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-0+git.20260512/node.h new/clknetsim-0+git.20260819/node.h --- old/clknetsim-0+git.20260512/node.h 2026-05-12 11:54:12.000000000 +0200 +++ new/clknetsim-0+git.20260819/node.h 2026-08-19 14:10:52.000000000 +0200 @@ -43,6 +43,8 @@ vector<struct Packet *> incoming_packets; + void drop_stale_packets(); + public: Node(int index, int clocks, Network *network); ~Node(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clknetsim-0+git.20260512/protocol.h new/clknetsim-0+git.20260819/protocol.h --- old/clknetsim-0+git.20260512/protocol.h 2026-05-12 11:54:12.000000000 +0200 +++ new/clknetsim-0+git.20260819/protocol.h 2026-08-19 14:10:52.000000000 +0200 @@ -112,6 +112,7 @@ #define MSG_TYPE_TCP_CONNECT 2 #define MSG_TYPE_TCP_DATA 3 #define MSG_TYPE_TCP_DISCONNECT 4 +#define MSG_TYPE_RAW_DATA 5 struct Request_send { unsigned int type; ++++++ clknetsim.obsinfo ++++++ --- /var/tmp/diff_new_pack.nbnbSu/_old 2026-08-22 21:37:43.966628486 +0200 +++ /var/tmp/diff_new_pack.nbnbSu/_new 2026-08-22 21:37:43.968628557 +0200 @@ -1,5 +1,5 @@ name: clknetsim -version: 0+git.20260512 -mtime: 1778579652 -commit: fcd076b8ffb1536820d9c4e9ef58ffd7a124325b +version: 0+git.20260819 +mtime: 1787141452 +commit: 56b60ef2e807bb8b62ce0741cbaa3875f8a58885
