)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"59c1939be28bbce9fd6eb7a82a9ab088f2113d17","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"1404565f_d0236f0d","updated":"2023-11-21 18:56:55.000000000","message":"this breaks OpenSolaris, as it has no sa_len element.  I\u0027ll look into a good fix, but things have kept me busy.","commit_id":"48621e1f08fa009181d05e1aacee93cfcf2e98bd"},{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"8299961179fe22a388dd7020a95bbe000bb31897","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"16867c7c_3f719c95","updated":"2023-12-30 15:03:43.000000000","message":"The ifr memcpy() is well understood and necessary.  The sockaddr_dl memcpy() needs at least some better comments, but maybe it\u0027s not necessary at all.","commit_id":"d18e5ada974447a25211ece8761158a56fe7786a"},{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"4e40ce30adb48a22d876b562f27b73960b904455","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"03b62eed_1c7245b2","updated":"2023-12-31 17:33:53.000000000","message":"I still find this all horribly ugly, but this is not your fault... this API is bad enough (... on MacOS, it seems) but combined with C \"undefined behaviour\" rules there is no hope for sanity...\n\nThat said, I have tested this on FreeBSD (works), NetBSD (works), OpenBSD (no AF_LINK provided, so, didn\u0027t work before, doesn\u0027t break anything now), MacOS (works) and OpenSolaris (no AF_LINK provided, but it compiles and tests fine).","commit_id":"41e54f5187e66e4b803e8bf4486fa6070a44fdfa"}],"src/openvpn/route.c":[{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"8299961179fe22a388dd7020a95bbe000bb31897","unresolved":true,"context_lines":[{"line_number":3674,"context_line":"        {"},{"line_number":3675,"context_line":"            struct ifreq ifr \u003d { 0 };"},{"line_number":3676,"context_line":"            /* this is not always using an 8 byte alignment that struct ifr"},{"line_number":3677,"context_line":"             * requires */"},{"line_number":3678,"context_line":"            memcpy(\u0026ifr, cp, sizeof(struct ifreq));"},{"line_number":3679,"context_line":"            const size_t len \u003d sizeof(ifr.ifr_name) + max(sizeof(ifr.ifr_addr), ifr.ifr_addr.sa_len);"},{"line_number":3680,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"b7cb53d2_d5e9c975","line":3677,"updated":"2023-12-30 15:03:43.000000000","message":"\"need to memcpy() to a strict ifr to force 8-byte alignment required for member access\"","commit_id":"d18e5ada974447a25211ece8761158a56fe7786a"},{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"8299961179fe22a388dd7020a95bbe000bb31897","unresolved":true,"context_lines":[{"line_number":3688,"context_line":"                {"},{"line_number":3689,"context_line":"                    /* This is a confusing member access on multiple levels."},{"line_number":3690,"context_line":"                     *"},{"line_number":3691,"context_line":"                     * struct sockaddr_dl is 20 bytes in size and has"},{"line_number":3692,"context_line":"                     * 12 bytes space for the hw address (6 bytes)"},{"line_number":3693,"context_line":"                     * and Ethernet interface name (max 16 bytes)"},{"line_number":3694,"context_line":"                     *"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"3ec0b40a_9dd8ee38","line":3691,"updated":"2023-12-30 15:03:43.000000000","message":"On FreeBSD 13 this is\n\n```\nstruct sockaddr_dl {\n        u_char  sdl_len;        /* Total length of sockaddr */\n        u_char  sdl_family;     /* AF_LINK */\n        u_short sdl_index;      /* if !\u003d 0, system given index for interface */\n        u_char  sdl_type;       /* interface type */\n        u_char  sdl_nlen;       /* interface name length, no trailing 0 reqd. */\n        u_char  sdl_alen;       /* link level address length */\n        u_char  sdl_slen;       /* link layer selector length */\n        char    sdl_data[46];   /* minimum work area, can be larger;\n                                   contains both if name and ll address */   \n};\n```\n\nso the \"20 bytes\" comment should be qualified \"on some of the BSDs\" or so (NetBSD indeed has only 20 bytes).  OpenBSD has\n\n```\n        char      sdl_data[24]; /* minimum work area, can be larger;\n                                   contains both if name and ll address;\n                                   big enough for IFNAMSIZ plus 8byte ll addr */\n```","commit_id":"d18e5ada974447a25211ece8761158a56fe7786a"},{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"8299961179fe22a388dd7020a95bbe000bb31897","unresolved":true,"context_lines":[{"line_number":3690,"context_line":"                     *"},{"line_number":3691,"context_line":"                     * struct sockaddr_dl is 20 bytes in size and has"},{"line_number":3692,"context_line":"                     * 12 bytes space for the hw address (6 bytes)"},{"line_number":3693,"context_line":"                     * and Ethernet interface name (max 16 bytes)"},{"line_number":3694,"context_line":"                     *"},{"line_number":3695,"context_line":"                     * So if the interface name is more than 6 byte, it"},{"line_number":3696,"context_line":"                     * extends beyond the struct."}],"source_content_type":"text/x-csrc","patch_set":2,"id":"5b60619c_c908b9eb","line":3693,"updated":"2023-12-30 15:03:43.000000000","message":"the wording here confused me (\"if it\u0027s hw address and interface name, in this order, why would we care about size of interface name?\") - I\u0027d swap the order around (\"..for interface name (max 16 bytes) and hw address (max 6 bytes\").","commit_id":"d18e5ada974447a25211ece8761158a56fe7786a"},{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"8299961179fe22a388dd7020a95bbe000bb31897","unresolved":true,"context_lines":[{"line_number":3700,"context_line":"                     * struct to potentially extend beyond the bounds of"},{"line_number":3701,"context_line":"                     * the struct."},{"line_number":3702,"context_line":"                     *"},{"line_number":3703,"context_line":"                     * Since we only copied 32 bytes from cp to ifr but sdl"},{"line_number":3704,"context_line":"                     * might extend after ifr\u0027s end, we  need to copy from"},{"line_number":3705,"context_line":"                     * cp directly to avoid missing out on extra bytes"},{"line_number":3706,"context_line":"                     * behind the struct"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"e6546e64_f9ad06e2","line":3703,"updated":"2023-12-30 15:03:43.000000000","message":"If ifr_addr.sa_len is \u003e16 (because \"long address\") the max() above will make us copy more than 32 bytes.  So maybe we already have everything we need here, and can spare ourselves the double twist?\n\nOTOH, the code below does max(sizeof(), sa_len) - so if sa_len is shorter, we might copy too much with the second copy?","commit_id":"d18e5ada974447a25211ece8761158a56fe7786a"},{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"f7da42a61041371d78cd3895b3188f41d7851051","unresolved":true,"context_lines":[{"line_number":3700,"context_line":"                     * struct to potentially extend beyond the bounds of"},{"line_number":3701,"context_line":"                     * the struct."},{"line_number":3702,"context_line":"                     *"},{"line_number":3703,"context_line":"                     * Since we only copied 32 bytes from cp to ifr but sdl"},{"line_number":3704,"context_line":"                     * might extend after ifr\u0027s end, we  need to copy from"},{"line_number":3705,"context_line":"                     * cp directly to avoid missing out on extra bytes"},{"line_number":3706,"context_line":"                     * behind the struct"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"ffdd8937_e4a1e87d","line":3703,"in_reply_to":"e6546e64_f9ad06e2","updated":"2023-12-30 15:46:55.000000000","message":"Ah, no, it\u0027s not that easy.  The code above does some arithmetics with len\u003d...+max(), but then doesn\u0027t actually memcpy(..., len) bytes but sizeof(ifr).\n\nNeed to think through this again.  But however, the comments need work to be understandable for mere mortals :-)","commit_id":"d18e5ada974447a25211ece8761158a56fe7786a"}]}
