+static int icmp6_ra_parse(sd_icmp6_nd *nd, struct nd_router_advert *ra,
+ ssize_t len) {
+ void *opt;
+ struct nd_opt_hdr *opt_hdr;
+
+ assert_return(nd, -EINVAL);
+ assert_return(ra, -EINVAL);
+
+ len -= sizeof(*ra);
+ if (len < ICMP6_OPT_LEN_UNITS) {
+ log_icmp6_nd(nd, "Router Advertisement below minimum length");
+
+ return -ENOMSG;
+ }
+
+ opt = ra + 1;
+ opt_hdr = opt;
+
+ while (len != 0 && len >= opt_hdr->nd_opt_len * ICMP6_OPT_LEN_UNITS) {
+
+ if (opt_hdr->nd_opt_len == 0)
+ return -ENOMSG;
+
+ switch (opt_hdr->nd_opt_type) {
+
+ }
+
+ len -= opt_hdr->nd_opt_len * ICMP6_OPT_LEN_UNITS;
+ opt = (void *)((char *)opt +
+ opt_hdr->nd_opt_len * ICMP6_OPT_LEN_UNITS);
+ opt_hdr = opt;
+ }
+
+ if (len > 0)
+ log_icmp6_nd(nd, "Router Advertisement contains %zd bytes of trailing garbage", len);
+
+ return 0;
+}
+