Deleted Added
full compact
1/*
2 * Copyright (c) 1999
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 42 unchanged lines hidden (view full) ---

51#include <unistd.h>
52#include <err.h>
53#include <errno.h>
54
55#include "ifconfig.h"
56
57#ifndef lint
58static const char rcsid[] =
59 "$FreeBSD: head/sbin/ifconfig/ifvlan.c 95005 2002-04-18 17:14:09Z imp $";
60#endif
61static int __tag = 0;
62static int __have_tag = 0;
63
64void
65vlan_status(int s, struct rt_addrinfo *info __unused)
66{
67 struct vlanreq vreq;
68
69 bzero((char *)&vreq, sizeof(struct vlanreq));
70 ifr.ifr_data = (caddr_t)&vreq;
71
72 if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
73 return;
74
75 printf("\tvlan: %d parent interface: %s\n",
76 vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ?
77 "<none>" : vreq.vlr_parent);
78
79 return;
80}
81
82void
83setvlantag(const char *val, int d, int s, const struct afswtch *afp)
84{
85 u_int16_t tag;
86 struct vlanreq vreq;
87
88 __tag = tag = atoi(val);
89 __have_tag = 1;
90

--- 6 unchanged lines hidden (view full) ---

97 vreq.vlr_tag = tag;
98
99 if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
100 err(1, "SIOCSETVLAN");
101
102 return;
103}
104
105void
106setvlandev(const char *val, int d, int s, const struct afswtch *afp)
107{
108 struct vlanreq vreq;
109
110 if (!__have_tag)
111 errx(1, "must specify both vlan tag and device");
112
113 bzero((char *)&vreq, sizeof(struct vlanreq));

--- 6 unchanged lines hidden (view full) ---

120 vreq.vlr_tag = __tag;
121
122 if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
123 err(1, "SIOCSETVLAN");
124
125 return;
126}
127
128void
129unsetvlandev(const char *val, int d, int s, const struct afswtch *afp)
130{
131 struct vlanreq vreq;
132
133 bzero((char *)&vreq, sizeof(struct vlanreq));
134 ifr.ifr_data = (caddr_t)&vreq;
135
136 if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
137 err(1, "SIOCGETVLAN");
138
139 bzero((char *)&vreq.vlr_parent, sizeof(vreq.vlr_parent));
140 vreq.vlr_tag = 0;
141
142 if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
143 err(1, "SIOCSETVLAN");
144
145 return;
146}