]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix an off-by-1 error decoding RFC3361.
authorRoy Marples <roy@marples.name>
Thu, 16 Jan 2014 09:29:42 +0000 (09:29 +0000)
committerRoy Marples <roy@marples.name>
Thu, 16 Jan 2014 09:29:42 +0000 (09:29 +0000)
We can use RFC3361 to decode the RFC3495 TSP sub option 3.
This means that RFC3495 is now fully supported.

dhcp-common.c
dhcpcd-definitions.conf

index 4715b61e8761e672d1785c1531fbf2484de6403d..c8db0738a2881d1e619816d0233cec57ba57f5aa 100644 (file)
@@ -390,7 +390,7 @@ print_option(char *s, ssize_t len, int type, int dl, const uint8_t *data,
                if ((tmp = decode_rfc3361(dl, data)) == NULL)
                        return -1;
                l = strlen(tmp);
-               l = print_string(s, len, l - 1, (uint8_t *)tmp);
+               l = print_string(s, len, l, (uint8_t *)tmp);
                free(tmp);
                return l;
        }
index 623aa5f172f19768eef3b96da0850001b6f8c029..9fdfb14618d13a6d9db1a7a7191db9746ace16e4 100644 (file)
@@ -135,15 +135,7 @@ define 120 rfc3361                 sip_server
 define 122     encap                   tsp
 encap 1                ipaddress               dhcp_server
 encap 2                ipaddress               dhcp_secondary_server
-encap 3                embed                   provisioning_server
-embed          byte                    type
-embed          domain                  fqdn
-#embed         ipaddress               address
-# We only support FQDN in option 3 out of the box which is type 0.
-# Type 1 is an ipaddress, but we currently have no logic to change embedded
-# type based on the content of an option.
-# To swap it out, just comment / uncomment the above two lines to your liking.
-# However, ensure that only one is uncommented.
+encap 3                rfc3361                 provisioning_server
 encap 4                embed                   as_req_as_rep_backoff
 embed          uint32                  nominal
 embed          uint32                  maximum