Home | History | Annotate | Download | only in ip

Lines Matching defs:ifr

48 static int tap_add_ioctl(struct ifreq *ifr, uid_t uid, gid_t gid)
54 ifr->ifr_flags |= IFF_TUN_EXCL;
62 if (ioctl(fd, TUNSETIFF, ifr)) {
84 static int tap_del_ioctl(struct ifreq *ifr)
93 if (ioctl(fd, TUNSETIFF, ifr)) {
107 static int parse_args(int argc, char **argv, struct ifreq *ifr, uid_t *uid, gid_t *gid)
111 memset(ifr, 0, sizeof(*ifr));
113 ifr->ifr_flags |= IFF_NO_PI;
119 if (ifr->ifr_flags & IFF_TAP) {
123 ifr->ifr_flags |= IFF_TUN;
125 if (ifr->ifr_flags & IFF_TUN) {
129 ifr->ifr_flags |= IFF_TAP;
166 ifr->ifr_flags &= ~IFF_NO_PI;
168 ifr->ifr_flags |= IFF_ONE_QUEUE;
170 ifr->ifr_flags |= IFF_VNET_HDR;
173 strncpy(ifr->ifr_name, *argv, IFNAMSIZ-1);
179 if (ifr->ifr_name[0])
181 strncpy(ifr->ifr_name, *argv, IFNAMSIZ);
193 struct ifreq ifr;
197 if (parse_args(argc, argv, &ifr, &uid, &gid) < 0)
200 if (!(ifr.ifr_flags & TUN_TYPE_MASK)) {
204 return tap_add_ioctl(&ifr, uid, gid);
209 struct ifreq ifr;
211 if (parse_args(argc, argv, &ifr, NULL, NULL) < 0)
214 return tap_del_ioctl(&ifr);