| 1033 | } |
| 1034 | |
| 1035 | int |
| 1036 | in6_src_ioctl(u_long cmd, caddr_t data) |
| 1037 | { |
| 1038 | struct in6_addrpolicy ent0; |
| 1039 | |
| 1040 | if (cmd != SIOCAADDRCTL_POLICY && cmd != SIOCDADDRCTL_POLICY) |
| 1041 | return (EOPNOTSUPP); /* check for safety */ |
| 1042 | |
| 1043 | ent0 = *(struct in6_addrpolicy *)data; |
| 1044 | |
| 1045 | if (ent0.label == ADDR_LABEL_NOTAPP) |
| 1046 | return (EINVAL); |
| 1047 | /* check if the prefix mask is consecutive. */ |
| 1048 | if (in6_mask2len(&ent0.addrmask.sin6_addr, NULL) < 0) |
| 1049 | return (EINVAL); |
| 1050 | /* clear trailing garbages (if any) of the prefix address. */ |
| 1051 | IN6_MASK_ADDR(&ent0.addr.sin6_addr, &ent0.addrmask.sin6_addr); |
| 1052 | ent0.use = 0; |
| 1053 | |
| 1054 | switch (cmd) { |
| 1055 | case SIOCAADDRCTL_POLICY: |
| 1056 | return (add_addrsel_policyent(&ent0)); |
| 1057 | case SIOCDADDRCTL_POLICY: |
| 1058 | return (delete_addrsel_policyent(&ent0)); |
| 1059 | } |
| 1060 | |
| 1061 | return (0); /* XXX: compromise compilers */ |
| 1062 | } |
| 1063 | |
| 1064 | /* |
| 1065 | * The followings are implementation of the policy table using a |
no test coverage detected