View | Details | Raw Unified | Return to bug 152928 | Differences between
and this patch

Collapse All | Expand All

(-)usr.sbin/rtadvd/if.h (+1 lines)
Lines 40-45 Link Here
40
struct sockaddr_dl *if_nametosdl(char *);
40
struct sockaddr_dl *if_nametosdl(char *);
41
int if_getmtu(char *);
41
int if_getmtu(char *);
42
int if_getflags(int, int);
42
int if_getflags(int, int);
43
int if_getifmstatus(char *);
43
int lladdropt_length(struct sockaddr_dl *);
44
int lladdropt_length(struct sockaddr_dl *);
44
void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
45
void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
45
int rtbuf_len(void);
46
int rtbuf_len(void);
(-)usr.sbin/rtadvd/if.c (-1 / +27 lines)
Lines 35-40 Link Here
35
#include <sys/sysctl.h>
35
#include <sys/sysctl.h>
36
#include <sys/ioctl.h>
36
#include <sys/ioctl.h>
37
#include <net/if.h>
37
#include <net/if.h>
38
#include <net/if_media.h>
38
#include <net/if_types.h>
39
#include <net/if_types.h>
39
#include <net/ethernet.h>
40
#include <net/ethernet.h>
40
#include <ifaddrs.h>
41
#include <ifaddrs.h>
Lines 203-208 Link Here
203
	return (ifr.ifr_flags);
204
	return (ifr.ifr_flags);
204
}
205
}
205
206
207
/* get interface media status */
208
int
209
if_getifmstatus(char *name)
210
{
211
	struct ifmediareq ifmr;
212
	int s;
213
214
	if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
215
		syslog(LOG_ERR, "<%s> socket: %s", __func__,
216
		       strerror(errno));
217
		return (~IFM_AVALID);
218
	}
219
220
	(void) memset(&ifmr, 0, sizeof(ifmr));
221
	(void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
222
	if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
223
		syslog(LOG_ERR, "<%s> ioctl:SIOCGIFMEDIA: failed for %s",
224
		       __func__, ifmr.ifm_name);
225
		close(s);
226
		return (~IFM_AVALID);
227
	}
228
	close(s);
229
	return (ifmr.ifm_status);
230
}
231
206
#define ROUNDUP8(a) (1 + (((a) - 1) | 7))
232
#define ROUNDUP8(a) (1 + (((a) - 1) | 7))
207
int
233
int
208
lladdropt_length(struct sockaddr_dl *sdl)
234
lladdropt_length(struct sockaddr_dl *sdl)
Lines 503-509 Link Here
503
529
504
/*
530
/*
505
 * alloc buffer and parse if_msghdrs block passed as arg,
531
 * alloc buffer and parse if_msghdrs block passed as arg,
506
 * and init the buffer as list of pointers ot each of the if_msghdr.
532
 * and init the buffer as list of pointers to each of the if_msghdr.
507
 */
533
 */
508
static void
534
static void
509
parse_iflist(struct if_msghdr ***ifmlist_p, char *buf, size_t bufsize)
535
parse_iflist(struct if_msghdr ***ifmlist_p, char *buf, size_t bufsize)
(-)usr.sbin/rtadvd/rtadvd.c (+10 lines)
Lines 37-42 Link Here
37
#include <sys/queue.h>
37
#include <sys/queue.h>
38
38
39
#include <net/if.h>
39
#include <net/if.h>
40
#include <net/if_media.h>
40
#include <net/route.h>
41
#include <net/route.h>
41
#include <net/if_dl.h>
42
#include <net/if_dl.h>
42
#include <netinet/in.h>
43
#include <netinet/in.h>
Lines 1556-1561 Link Here
1556
	struct cmsghdr *cm;
1557
	struct cmsghdr *cm;
1557
	struct in6_pktinfo *pi;
1558
	struct in6_pktinfo *pi;
1558
	struct soliciter *sol, *nextsol;
1559
	struct soliciter *sol, *nextsol;
1560
	struct ifmediareq ifmr;
1559
1561
1560
	if ((iflist[rainfo->ifindex]->ifm_flags & IFF_UP) == 0) {
1562
	if ((iflist[rainfo->ifindex]->ifm_flags & IFF_UP) == 0) {
1561
		syslog(LOG_DEBUG, "<%s> %s is not up, skip sending RA",
1563
		syslog(LOG_DEBUG, "<%s> %s is not up, skip sending RA",
Lines 1563-1568 Link Here
1563
		return;
1565
		return;
1564
	}
1566
	}
1565
1567
1568
	if ((if_getifmstatus(rainfo->ifname) & (IFM_AVALID | IFM_ACTIVE))
1569
	    != (IFM_AVALID | IFM_ACTIVE)) {
1570
		syslog(LOG_DEBUG,
1571
		    "<%s> %s media is not active, skip sending RA",
1572
		    __func__, rainfo->ifname);
1573
		return;
1574
	}
1575
1566
	make_packet(rainfo);	/* XXX: inefficient */
1576
	make_packet(rainfo);	/* XXX: inefficient */
1567
1577
1568
	sndmhdr.msg_name = (caddr_t)&sin6_allnodes;
1578
	sndmhdr.msg_name = (caddr_t)&sin6_allnodes;

Return to bug 152928