MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in6_src_ioctl

Function in6_src_ioctl

freebsd/netinet6/in6_src.c:1035–1062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1033}
1034
1035int
1036in6_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

Callers 1

in6_controlFunction · 0.85

Calls 3

in6_mask2lenFunction · 0.85
add_addrsel_policyentFunction · 0.85
delete_addrsel_policyentFunction · 0.85

Tested by

no test coverage detected