/* This is yet another James Morris contribution (I'm an IP-level guy, so I dislike bridging), and I just try not to break it.  */
static void add_to_bridge(int fd, const char *if_name, const char *br_name)
/* This is yet another James Morris contribution (I'm an IP-level guy, so I dislike bridging), and I just try not to break it.  */
static void add_to_bridge(int fd, const char *if_name, const char *br_name)
{
	int ifidx;
	struct ifreq ifr;
	if (!*br_name)
		errx(1, "must specify bridge name");
	ifidx = if_nametoindex(if_name);
	if (!ifidx)
		errx(1, "interface %s does not exist!", if_name);
	strncpy(ifr.ifr_name, br_name, IFNAMSIZ);
	ifr.ifr_name[IFNAMSIZ-1] = '\0';
	ifr.ifr_ifindex = ifidx;
	if (ioctl(fd, SIOCBRADDIF, &ifr) < 0)
		err(1, "can't add %s to bridge %s", if_name, br_name);
}