Lines Matching refs:req

385 	} req;  in iproute_modify()  local
394 memset(&req, 0, sizeof(req)); in iproute_modify()
396 req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); in iproute_modify()
397 req.n.nlmsg_flags = NLM_F_REQUEST | flags; in iproute_modify()
398 req.n.nlmsg_type = cmd; in iproute_modify()
399 req.r.rtm_family = preferred_family; in iproute_modify()
401 req.r.rtm_table = RT_TABLE_MAIN; in iproute_modify()
403 req.r.rtm_scope = RT_SCOPE_NOWHERE; in iproute_modify()
406 req.r.rtm_scope = RT_SCOPE_UNIVERSE; in iproute_modify()
408 req.r.rtm_protocol = RTPROT_BOOT; in iproute_modify()
410 req.r.rtm_type = RTN_UNICAST; in iproute_modify()
421 get_addr(&addr, *argv, req.r.rtm_family); in iproute_modify()
422 if (req.r.rtm_family == AF_UNSPEC) in iproute_modify()
423 req.r.rtm_family = addr.family; in iproute_modify()
424 addattr_l(&req.n, sizeof(req), RTA_PREFSRC, &addr.data, addr.bytelen); in iproute_modify()
429 get_addr(&addr, *argv, req.r.rtm_family); in iproute_modify()
430 if (req.r.rtm_family == AF_UNSPEC) { in iproute_modify()
431 req.r.rtm_family = addr.family; in iproute_modify()
433 addattr_l(&req.n, sizeof(req), RTA_GATEWAY, &addr.data, addr.bytelen); in iproute_modify()
457 req.r.rtm_scope = scope; in iproute_modify()
464 req.r.rtm_protocol = prot; in iproute_modify()
474 req.r.rtm_table = RT_TABLE_UNSPEC; in iproute_modify()
475 addattr32(&req.n, sizeof(req), RTA_TABLE, tid); in iproute_modify()
478 req.r.rtm_table = tid; in iproute_modify()
488 addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric); in iproute_modify()
490 req.r.rtm_flags |= RTNH_F_ONLINK; in iproute_modify()
502 req.r.rtm_type = type; in iproute_modify()
509 get_prefix(&dst, *argv, req.r.rtm_family); in iproute_modify()
510 if (req.r.rtm_family == AF_UNSPEC) { in iproute_modify()
511 req.r.rtm_family = dst.family; in iproute_modify()
513 req.r.rtm_dst_len = dst.bitlen; in iproute_modify()
516 addattr_l(&req.n, sizeof(req), RTA_DST, &dst.data, dst.bytelen); in iproute_modify()
524 get_prefix(&addr, *argv, req.r.rtm_family); in iproute_modify()
525 if (req.r.rtm_family == AF_UNSPEC) in iproute_modify()
526 req.r.rtm_family = addr.family; in iproute_modify()
528 addattr_l(&req.n, sizeof(req), RTA_SRC, &addr.data, addr.bytelen); in iproute_modify()
529 req.r.rtm_src_len = addr.bitlen; in iproute_modify()
536 req.r.rtm_tos = tos; in iproute_modify()
665 addattr32(&req.n, sizeof(req), RTA_FLOW, realm); in iproute_modify()
683 addattr32(&req.n, sizeof(req), RTA_OIF, idx);
691 addattr_l(&req.n, sizeof(req), RTA_METRICS, RTA_DATA(mxrta), RTA_PAYLOAD(mxrta));
695 if (req.r.rtm_type == RTN_LOCAL || req.r.rtm_type == RTN_NAT)
696 req.r.rtm_scope = RT_SCOPE_HOST;
698 if (req.r.rtm_type == RTN_BROADCAST
699 || req.r.rtm_type == RTN_MULTICAST
700 || req.r.rtm_type == RTN_ANYCAST
702 req.r.rtm_scope = RT_SCOPE_LINK;
704 else if (req.r.rtm_type == RTN_UNICAST || req.r.rtm_type == RTN_UNSPEC) {
706 req.r.rtm_scope = RT_SCOPE_NOWHERE;
708 req.r.rtm_scope = RT_SCOPE_LINK;
712 if (req.r.rtm_family == AF_UNSPEC) {
713 req.r.rtm_family = AF_INET;
716 if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) {
728 } req; in rtnl_rtcache_request() local
732 memset(&req, 0, sizeof(req)); in rtnl_rtcache_request()
735 req.nlh.nlmsg_len = sizeof(req); in rtnl_rtcache_request()
737 req.nlh.nlmsg_type = RTM_GETROUTE; in rtnl_rtcache_request()
739 req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_REQUEST; in rtnl_rtcache_request()
741 req.nlh.nlmsg_seq = rth->dump = ++rth->seq; in rtnl_rtcache_request()
742 req.rtm.rtm_family = family; in rtnl_rtcache_request()
744 req.rtm.rtm_flags = RTM_F_CLONED; in rtnl_rtcache_request()
746 return xsendto(rth->fd, (void*)&req, sizeof(req), (struct sockaddr*)&nladdr, sizeof(nladdr)); in rtnl_rtcache_request()
967 } req; in iproute_get() local
975 memset(&req, 0, sizeof(req)); in iproute_get()
979 req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); in iproute_get()
981 req.n.nlmsg_flags = NLM_F_REQUEST; in iproute_get()
983 req.n.nlmsg_type = RTM_GETROUTE; in iproute_get()
984 req.r.rtm_family = preferred_family; in iproute_get()
1000 get_prefix(&addr, *argv, req.r.rtm_family); in iproute_get()
1001 if (req.r.rtm_family == AF_UNSPEC) { in iproute_get()
1002 req.r.rtm_family = addr.family; in iproute_get()
1005 addattr_l(&req.n, sizeof(req), RTA_SRC, &addr.data, addr.bytelen); in iproute_get()
1007 req.r.rtm_src_len = addr.bitlen; in iproute_get()
1020 req.r.rtm_flags |= RTM_F_NOTIFY; in iproute_get()
1030 get_prefix(&addr, *argv, req.r.rtm_family); in iproute_get()
1031 if (req.r.rtm_family == AF_UNSPEC) { in iproute_get()
1032 req.r.rtm_family = addr.family; in iproute_get()
1035 addattr_l(&req.n, sizeof(req), RTA_DST, &addr.data, addr.bytelen); in iproute_get()
1037 req.r.rtm_dst_len = addr.bitlen; in iproute_get()
1043 if (req.r.rtm_dst_len == 0) { in iproute_get()
1056 addattr32(&req.n, sizeof(req), RTA_IIF, idx); in iproute_get()
1060 addattr32(&req.n, sizeof(req), RTA_OIF, idx); in iproute_get()
1064 if (req.r.rtm_family == AF_UNSPEC) { in iproute_get()
1065 req.r.rtm_family = AF_INET; in iproute_get()
1068 if (rtnl_talk(&rth, &req.n, 0, 0, &req.n, NULL, NULL) < 0) { in iproute_get()
1073 struct rtmsg *r = NLMSG_DATA(&req.n); in iproute_get()
1074 int len = req.n.nlmsg_len; in iproute_get()
1077 print_route(NULL, &req.n, NULL); in iproute_get()
1079 if (req.n.nlmsg_type != RTM_NEWROUTE) { in iproute_get()
1105 req.n.nlmsg_flags = NLM_F_REQUEST; in iproute_get()
1106 req.n.nlmsg_type = RTM_GETROUTE; in iproute_get()
1108 if (rtnl_talk(&rth, &req.n, 0, 0, &req.n, NULL, NULL) < 0) { in iproute_get()
1112 print_route(NULL, &req.n, NULL); in iproute_get()