Deleted Added
full compact
ifvlan.c (186108) ifvlan.c (189096)
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 186108 2008-12-15 01:44:23Z sam $";
59 "$FreeBSD: head/sbin/ifconfig/ifvlan.c 189096 2009-02-27 00:31:34Z rpaulo $";
60#endif
61
62#define NOTAG ((u_short) -1)
63
64static struct vlanreq params = {
65 .vlr_tag = NOTAG,
66};
67

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

131 errx(1, "invalid value for vlan");
132 params.vlr_tag = ul;
133 /* check if the value can be represented in vlr_tag */
134 if (params.vlr_tag != ul)
135 errx(1, "value for vlan out of range");
136
137 if (getvlan(s, &ifr, &vreq) != -1)
138 vlan_set(s, &ifr);
60#endif
61
62#define NOTAG ((u_short) -1)
63
64static struct vlanreq params = {
65 .vlr_tag = NOTAG,
66};
67

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

131 errx(1, "invalid value for vlan");
132 params.vlr_tag = ul;
133 /* check if the value can be represented in vlr_tag */
134 if (params.vlr_tag != ul)
135 errx(1, "value for vlan out of range");
136
137 if (getvlan(s, &ifr, &vreq) != -1)
138 vlan_set(s, &ifr);
139 else
140 clone_setcallback(vlan_create);
141}
142
143static
144DECL_CMD_FUNC(setvlandev, val, d)
145{
146 struct vlanreq vreq;
147
148 strlcpy(params.vlr_parent, val, sizeof(params.vlr_parent));
149
150 if (getvlan(s, &ifr, &vreq) != -1)
151 vlan_set(s, &ifr);
139}
140
141static
142DECL_CMD_FUNC(setvlandev, val, d)
143{
144 struct vlanreq vreq;
145
146 strlcpy(params.vlr_parent, val, sizeof(params.vlr_parent));
147
148 if (getvlan(s, &ifr, &vreq) != -1)
149 vlan_set(s, &ifr);
152 else
153 clone_setcallback(vlan_create);
154}
155
156static
157DECL_CMD_FUNC(unsetvlandev, val, d)
158{
159 struct vlanreq vreq;
160
161 bzero((char *)&vreq, sizeof(struct vlanreq));

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

197{
198#define N(a) (sizeof(a) / sizeof(a[0]))
199 int i;
200
201 for (i = 0; i < N(vlan_cmds); i++)
202 cmd_register(&vlan_cmds[i]);
203 af_register(&af_vlan);
204 callback_register(vlan_cb, NULL);
150}
151
152static
153DECL_CMD_FUNC(unsetvlandev, val, d)
154{
155 struct vlanreq vreq;
156
157 bzero((char *)&vreq, sizeof(struct vlanreq));

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

193{
194#define N(a) (sizeof(a) / sizeof(a[0]))
195 int i;
196
197 for (i = 0; i < N(vlan_cmds); i++)
198 cmd_register(&vlan_cmds[i]);
199 af_register(&af_vlan);
200 callback_register(vlan_cb, NULL);
201 clone_setdefcallback("vlan", vlan_create);
205#undef N
206}
202#undef N
203}