Lines Matching refs:xfrm_sock

914 static int xfrm_state_add(int xfrm_sock, uint32_t seq, uint32_t spi,  in xfrm_state_add()  argument
957 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_state_add()
962 return netlink_check_answer(xfrm_sock); in xfrm_state_add()
1003 static int xfrm_state_check(int xfrm_sock, uint32_t seq, uint32_t spi, in xfrm_state_check() argument
1040 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_state_check()
1046 if (recv(xfrm_sock, &answer, sizeof(answer), 0) < 0) { in xfrm_state_check()
1066 static int xfrm_set(int xfrm_sock, uint32_t *seq, in xfrm_set() argument
1073 err = xfrm_state_add(xfrm_sock, (*seq)++, gen_spi(src), src, dst, desc); in xfrm_set()
1079 err = xfrm_state_add(xfrm_sock, (*seq)++, gen_spi(src), dst, src, desc); in xfrm_set()
1086 err = xfrm_state_check(xfrm_sock, (*seq)++, gen_spi(src), src, dst, desc); in xfrm_set()
1087 err |= xfrm_state_check(xfrm_sock, (*seq)++, gen_spi(src), dst, src, desc); in xfrm_set()
1096 static int xfrm_policy_add(int xfrm_sock, uint32_t seq, uint32_t spi, in xfrm_policy_add() argument
1144 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_policy_add()
1149 return netlink_check_answer(xfrm_sock); in xfrm_policy_add()
1152 static int xfrm_prepare(int xfrm_sock, uint32_t *seq, in xfrm_prepare() argument
1156 if (xfrm_policy_add(xfrm_sock, (*seq)++, gen_spi(src), src, dst, in xfrm_prepare()
1162 if (xfrm_policy_add(xfrm_sock, (*seq)++, gen_spi(src), dst, src, in xfrm_prepare()
1171 static int xfrm_policy_del(int xfrm_sock, uint32_t seq, in xfrm_policy_del() argument
1195 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_policy_del()
1200 return netlink_check_answer(xfrm_sock); in xfrm_policy_del()
1203 static int xfrm_cleanup(int xfrm_sock, uint32_t *seq, in xfrm_cleanup() argument
1207 if (xfrm_policy_del(xfrm_sock, (*seq)++, src, dst, in xfrm_cleanup()
1213 if (xfrm_policy_del(xfrm_sock, (*seq)++, dst, src, in xfrm_cleanup()
1222 static int xfrm_state_del(int xfrm_sock, uint32_t seq, uint32_t spi, in xfrm_state_del() argument
1248 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_state_del()
1253 return netlink_check_answer(xfrm_sock); in xfrm_state_del()
1256 static int xfrm_delete(int xfrm_sock, uint32_t *seq, in xfrm_delete() argument
1260 if (xfrm_state_del(xfrm_sock, (*seq)++, gen_spi(src), src, dst, proto)) { in xfrm_delete()
1265 if (xfrm_state_del(xfrm_sock, (*seq)++, gen_spi(src), dst, src, proto)) { in xfrm_delete()
1273 static int xfrm_state_allocspi(int xfrm_sock, uint32_t *seq, in xfrm_state_allocspi() argument
1299 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_state_allocspi()
1304 if (recv(xfrm_sock, &answer, sizeof(answer), 0) < 0) { in xfrm_state_allocspi()
1364 static int xfrm_monitor_acquire(int xfrm_sock, uint32_t *seq, unsigned int nr) in xfrm_monitor_acquire() argument
1397 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_monitor_acquire()
1402 if (recv(xfrm_sock, &req, sizeof(req), 0) < 0) { in xfrm_monitor_acquire()
1434 static int xfrm_expire_state(int xfrm_sock, uint32_t *seq, in xfrm_expire_state() argument
1451 if (xfrm_state_add(xfrm_sock, (*seq)++, gen_spi(src), src, dst, desc)) { in xfrm_expire_state()
1471 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_expire_state()
1476 if (recv(xfrm_sock, &req, sizeof(req), 0) < 0) { in xfrm_expire_state()
1506 static int xfrm_expire_policy(int xfrm_sock, uint32_t *seq, in xfrm_expire_policy() argument
1525 if (xfrm_policy_add(xfrm_sock, (*seq)++, gen_spi(src), src, dst, in xfrm_expire_policy()
1549 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_expire_policy()
1554 if (recv(xfrm_sock, &req, sizeof(req), 0) < 0) { in xfrm_expire_policy()
1584 static int xfrm_spdinfo_set_thresh(int xfrm_sock, uint32_t *seq, in xfrm_spdinfo_set_thresh() argument
1624 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_spdinfo_set_thresh()
1629 if (recv(xfrm_sock, &req, sizeof(req), 0) < 0) { in xfrm_spdinfo_set_thresh()
1645 static int xfrm_spdinfo_attrs(int xfrm_sock, uint32_t *seq) in xfrm_spdinfo_attrs() argument
1656 if (xfrm_spdinfo_set_thresh(xfrm_sock, seq, 32, 31, 120, 16, false)) { in xfrm_spdinfo_attrs()
1667 if (send(xfrm_sock, &req, req.nh.nlmsg_len, 0) < 0) { in xfrm_spdinfo_attrs()
1672 if (recv(xfrm_sock, &req, sizeof(req), 0) < 0) { in xfrm_spdinfo_attrs()
1715 if (xfrm_spdinfo_set_thresh(xfrm_sock, seq, 32, 32, 128, 128, false)) { in xfrm_spdinfo_attrs()
1727 if (xfrm_spdinfo_set_thresh(xfrm_sock, seq, 32, 32, 128, 128, true)) in xfrm_spdinfo_attrs()
1733 static int child_serv(int xfrm_sock, uint32_t *seq, in child_serv() argument
1756 if (xfrm_prepare(xfrm_sock, seq, src, dst, tunsrc, tundst, desc->proto)) { in child_serv()
1765 if (xfrm_set(xfrm_sock, seq, src, dst, tunsrc, tundst, desc)) { in child_serv()
1785 if (xfrm_delete(xfrm_sock, seq, src, dst, tunsrc, tundst, desc->proto)) { in child_serv()
1795 if (xfrm_cleanup(xfrm_sock, seq, src, dst, tunsrc, tundst)) { in child_serv()
1806 int xfrm_sock = -1; in child_f() local
1812 if (netlink_sock(&xfrm_sock, &seq, NETLINK_XFRM)) { in child_f()
1841 ret = child_serv(xfrm_sock, &seq, nr, in child_f()
1845 ret = xfrm_state_allocspi(xfrm_sock, &seq, in child_f()
1849 ret = xfrm_monitor_acquire(xfrm_sock, &seq, nr); in child_f()
1852 ret = xfrm_expire_state(xfrm_sock, &seq, nr, &desc); in child_f()
1855 ret = xfrm_expire_policy(xfrm_sock, &seq, nr, &desc); in child_f()
1858 ret = xfrm_spdinfo_attrs(xfrm_sock, &seq); in child_f()
1867 close(xfrm_sock); in child_f()
1875 struct test_desc *msg, int xfrm_sock, uint32_t *seq) in grand_child_serv() argument
1902 if (xfrm_prepare(xfrm_sock, seq, src, dst, tunsrc, tundst, in grand_child_serv()
1904 xfrm_cleanup(xfrm_sock, seq, src, dst, tunsrc, tundst); in grand_child_serv()
1909 if (xfrm_set(xfrm_sock, seq, src, dst, tunsrc, tundst, desc)) { in grand_child_serv()
1910 xfrm_cleanup(xfrm_sock, seq, src, dst, tunsrc, tundst); in grand_child_serv()
1915 if (xfrm_delete(xfrm_sock, seq, src, dst, tunsrc, tundst, in grand_child_serv()
1917 xfrm_cleanup(xfrm_sock, seq, src, dst, tunsrc, tundst); in grand_child_serv()
1922 if (xfrm_cleanup(xfrm_sock, seq, src, dst, tunsrc, tundst)) { in grand_child_serv()
1934 int xfrm_sock = -1; in grand_child_f() local
1940 if (netlink_sock(&xfrm_sock, &seq, NETLINK_XFRM)) { in grand_child_f()
1947 grand_child_serv(nr, cmd_fd, buf, &msg, xfrm_sock, &seq); in grand_child_f()
1950 close(xfrm_sock); in grand_child_f()