originateTimestamp equals 0 in returned packet
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu trong index.js tại NTP.createPacket và tái hiện vấn đề bằng ví dụ được nêu trong báo cáo. So sánh packet đã được tạo với hành vi được trích dẫn trong RFC 2030, sau đó xác minh rằng các timestamp được trả về cho phép sử dụng độ trễ khứ hồi và độ lệch đồng hồ hệ thống.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Running the slightly modified example
const ntp = require('..');
ntp(function(err, response){
if(err) return console.error(err);
console.log(response);
});
originateTimestamp === 0 is returned which renders roundtrip delay d and system clock offset t unusable.
Packet {
leapIndicator: 0,
version: 4,
mode: 4,
stratum: 2,
pollInterval: 6,
precision: 233,
referenceIdentifier: <Buffer c0 35 67 6c>,
referenceTimestamp: 1577013057260.7312,
originateTimestamp: 0,
receiveTimestamp: 1577013390216.6448,
transmitTimestamp: 1577013390216.6702,
rootDelay: <Buffer 00 00 01 d5>,
rootDispersion: <Buffer 00 00 07 07>,
destinationTimestamp: 1577013390262,
time: 2019-12-22T11:16:30.216Z,
d: 1577013390261.9746,
t: 788506695085.6575
}
According to https://tools.ietf.org/html/rfc2030#section-6
In unicast and anycast modes, the Receive Timestamp and Transmit Timestamp
fields are set to the time of day when the message is sent and the
Originate Timestamp field is copied unchanged from the Transmit
Timestamp field of the request. It is important that this field be
copied intact, as a NTP client uses it to avoid replays. In multicast
mode, the Originate Timestamp and Receive Timestamp fields are set to
0 and the Transmit Timestamp field is set to the time of day when the
message is sent.
I suppose that client and server operate in unicast/ anycast mode. If this is the case I would like to change:
--- a/index.js
+++ b/index.js
@@ -63,7 +63,7 @@ NTP.prototype.time = function (callback) {
NTP.createPacket = function () {
const packet = new Packet();
packet.mode = Packet.MODES.CLIENT;
- packet.originateTimestamp = Date.now();
+ packet.transmitTimestamp = Date.now();
return packet.toBuffer();
};
- Ngôn ngữ chính
- JavaScript
- Star
- 28
- Fork
- 8
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue tương tự
-
Add: Digi 4K LogoĐang mởcheck:passed logos:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
component/administration domain/framework needs-triage Platform(Default) priority/low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
semantic-release/gitlab#1032 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[aw] Upgrade availableĐang mởagentic-workflows
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
githubnext/gh-aw-workshop#3933 ·
Maintainer thường phản hồi trong vòng 1 ngày