Deleted Added
full compact
ifvlan.c (83888) ifvlan.c (95005)
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[] =
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 83888 2001-09-24 15:00:16Z rwatson $";
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
60#endif
61static int __tag = 0;
62static int __have_tag = 0;
63
64void vlan_status(s, info)
65 int s;
66 struct rt_addrinfo *info __unused;
64void
65vlan_status(int s, struct rt_addrinfo *info __unused)
67{
68 struct vlanreq vreq;
69
70 bzero((char *)&vreq, sizeof(struct vlanreq));
71 ifr.ifr_data = (caddr_t)&vreq;
72
73 if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
74 return;
75
76 printf("\tvlan: %d parent interface: %s\n",
77 vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ?
78 "<none>" : vreq.vlr_parent);
79
80 return;
81}
82
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
83void setvlantag(val, d, s, afp)
84 const char *val;
85 int d, s;
86 const struct afswtch *afp;
82void
83setvlantag(const char *val, int d, int s, const struct afswtch *afp)
87{
88 u_int16_t tag;
89 struct vlanreq vreq;
90
91 __tag = tag = atoi(val);
92 __have_tag = 1;
93
94 bzero((char *)&vreq, sizeof(struct vlanreq));

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

100 vreq.vlr_tag = tag;
101
102 if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
103 err(1, "SIOCSETVLAN");
104
105 return;
106}
107
84{
85 u_int16_t tag;
86 struct vlanreq vreq;
87
88 __tag = tag = atoi(val);
89 __have_tag = 1;
90
91 bzero((char *)&vreq, sizeof(struct vlanreq));

--- 5 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
108void setvlandev(val, d, s, afp)
109 const char *val;
110 int d, s;
111 const struct afswtch *afp;
105void
106setvlandev(const char *val, int d, int s, const struct afswtch *afp)
112{
113 struct vlanreq vreq;
114
115 if (!__have_tag)
116 errx(1, "must specify both vlan tag and device");
117
118 bzero((char *)&vreq, sizeof(struct vlanreq));
119 ifr.ifr_data = (caddr_t)&vreq;

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

125 vreq.vlr_tag = __tag;
126
127 if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
128 err(1, "SIOCSETVLAN");
129
130 return;
131}
132
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));
114 ifr.ifr_data = (caddr_t)&vreq;

--- 5 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
133void unsetvlandev(val, d, s, afp)
134 const char *val;
135 int d, s;
136 const struct afswtch *afp;
128void
129unsetvlandev(const char *val, int d, int s, const struct afswtch *afp)
137{
138 struct vlanreq vreq;
139
140 bzero((char *)&vreq, sizeof(struct vlanreq));
141 ifr.ifr_data = (caddr_t)&vreq;
142
143 if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1)
144 err(1, "SIOCGETVLAN");
145
146 bzero((char *)&vreq.vlr_parent, sizeof(vreq.vlr_parent));
147 vreq.vlr_tag = 0;
148
149 if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1)
150 err(1, "SIOCSETVLAN");
151
152 return;
153}
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}