strncpy(p->name, *argv, IFNAMSIZ);
safe_strncpy(p->name, *argv, IFNAMSIZ);
static int parse_args(int argc, char **argv, struct ip_tunnel_parm *p){	char medium[IFNAMSIZ];	memset(p, 0, sizeof(*p));	memset(&medium, 0, sizeof(medium));	p->iph.version = 4;	p->iph.ihl = 5;#ifndef IP_DF#define IP_DF		0x4000		/* Flag: "Don't Fragment"	*/#endif	p->iph.frag_off = htons(IP_DF);	while (argc > 0) {		if (strcmp(*argv, "mode") == 0) {			NEXT_ARG();			if (strcmp(*argv, "ipip") == 0) {				if (p->iph.protocol)					usage();				p->iph.protocol = IPPROTO_IPIP;			} else if (strcmp(*argv, "gre") == 0) {				if (p->iph.protocol)					usage();				p->iph.protocol = IPPROTO_GRE;			} else if (strcmp(*argv, "sit") == 0) {				if (p->iph.protocol)					usage();				p->iph.protocol = IPPROTO_IPV6;			} else				usage();		} else if (strcmp(*argv, "key") == 0) {			unsigned uval;			NEXT_ARG();			p->i_flags |= GRE_KEY;			p->o_flags |= GRE_KEY;			if (strchr(*argv, '.'))				p->i_key = p->o_key = get_addr32(*argv);			else {				if (scan_number(*argv, &uval)<0)					usage();				p->i_key = p->o_key = htonl(uval);			}		} else if (strcmp(*argv, "ikey") == 0) {			unsigned uval;			NEXT_ARG();			p->i_flags |= GRE_KEY;			if (strchr(*argv, '.'))				p->o_key = get_addr32(*argv);			else {				if (scan_number(*argv, &uval)<0)					usage();				p->i_key = htonl(uval);			}		} else if (strcmp(*argv, "okey") == 0) {			unsigned uval;			NEXT_ARG();			p->o_flags |= GRE_KEY;			if (strchr(*argv, '.'))				p->o_key = get_addr32(*argv);			else {				if (scan_number(*argv, &uval)<0)					usage();				p->o_key = htonl(uval);			}		} else if (strcmp(*argv, "seq") == 0) {			p->i_flags |= GRE_SEQ;			p->o_flags |= GRE_SEQ;		} else if (strcmp(*argv, "iseq") == 0) {			p->i_flags |= GRE_SEQ;		} else if (strcmp(*argv, "oseq") == 0) {			p->o_flags |= GRE_SEQ;		} else if (strcmp(*argv, "csum") == 0) {			p->i_flags |= GRE_CSUM;			p->o_flags |= GRE_CSUM;		} else if (strcmp(*argv, "icsum") == 0) {			p->i_flags |= GRE_CSUM;		} else if (strcmp(*argv, "ocsum") == 0) {			p->o_flags |= GRE_CSUM;		} else if (strcmp(*argv, "nopmtudisc") == 0) {			p->iph.frag_off = 0;		} else if (strcmp(*argv, "remote") == 0) {			NEXT_ARG();			if (strcmp(*argv, "any"))				p->iph.daddr = get_addr32(*argv);		} else if (strcmp(*argv, "local") == 0) {			NEXT_ARG();			if (strcmp(*argv, "any"))				p->iph.saddr = get_addr32(*argv);		} else if (strcmp(*argv, "dev") == 0) {			NEXT_ARG();			strncpy(medium, *argv, IFNAMSIZ-1);		} else if (strcmp(*argv, "ttl") == 0) {			unsigned uval;			NEXT_ARG();			if (strcmp(*argv, "inherit") != 0) {				if (scan_number(*argv, &uval)<0)					usage();				if (uval > 255)					usage();				p->iph.ttl = uval;			}		} else if (strcmp(*argv, "tos") == 0) {			unsigned uval;			NEXT_ARG();			if (strcmp(*argv, "inherit") != 0) {				if (scan_number(*argv, &uval)<0)					usage();				if (uval > 255)					usage();				p->iph.tos = uval;			} else				p->iph.tos = 1;		} else {			if (p->name[0])				usage();			strncpy(p->name, *argv, IFNAMSIZ);		}		argc--; argv++;	}	if (p->iph.protocol == 0) {		if (memcmp(p->name, "gre", 3) == 0)			p->iph.protocol = IPPROTO_GRE;		else if (memcmp(p->name, "ipip", 4) == 0)			p->iph.protocol = IPPROTO_IPIP;		else if (memcmp(p->name, "sit", 3) == 0)			p->iph.protocol = IPPROTO_IPV6;	}	if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) {		if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {			fprintf(stderr, _("Keys are not allowed with ipip and sit.\n"));			return -1;		}	}	if (medium[0]) {		p->link = do_ioctl_get_ifindex(medium);		if (p->link == 0)			return -1;	}	if (p->i_key == 0 && IN_MULTICAST(ntohl(p->iph.daddr))) {		p->i_key = p->iph.daddr;		p->i_flags |= GRE_KEY;	}	if (p->o_key == 0 && IN_MULTICAST(ntohl(p->iph.daddr))) {		p->o_key = p->iph.daddr;		p->o_flags |= GRE_KEY;	}	if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) {		fprintf(stderr, _("Broadcast tunnel requires a source address.\n"));		return -1;	}	return 0;}