Deleted Added
full compact
ng_ether.c (141720) ng_ether.c (141721)
1
2/*
3 * ng_ether.c
4 */
5
6/*-
7 * Copyright (c) 1996-2000 Whistle Communications, Inc.
8 * All rights reserved.

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

34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
37 * OF SUCH DAMAGE.
38 *
39 * Authors: Archie Cobbs <archie@freebsd.org>
40 * Julian Elischer <julian@freebsd.org>
41 *
1
2/*
3 * ng_ether.c
4 */
5
6/*-
7 * Copyright (c) 1996-2000 Whistle Communications, Inc.
8 * All rights reserved.

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

34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
37 * OF SUCH DAMAGE.
38 *
39 * Authors: Archie Cobbs <archie@freebsd.org>
40 * Julian Elischer <julian@freebsd.org>
41 *
42 * $FreeBSD: head/sys/netgraph/ng_ether.c 141720 2005-02-12 11:14:25Z ru $
42 * $FreeBSD: head/sys/netgraph/ng_ether.c 141721 2005-02-12 11:41:32Z glebius $
43 */
44
45/*
46 * ng_ether(4) netgraph node type
47 */
48
49#include <sys/param.h>
50#include <sys/systm.h>
51#include <sys/kernel.h>
52#include <sys/malloc.h>
53#include <sys/mbuf.h>
54#include <sys/errno.h>
55#include <sys/syslog.h>
56#include <sys/socket.h>
57
58#include <net/bridge.h>
59#include <net/if.h>
43 */
44
45/*
46 * ng_ether(4) netgraph node type
47 */
48
49#include <sys/param.h>
50#include <sys/systm.h>
51#include <sys/kernel.h>
52#include <sys/malloc.h>
53#include <sys/mbuf.h>
54#include <sys/errno.h>
55#include <sys/syslog.h>
56#include <sys/socket.h>
57
58#include <net/bridge.h>
59#include <net/if.h>
60#include <net/if_dl.h>
60#include <net/if_types.h>
61#include <net/if_arp.h>
62#include <net/if_var.h>
63#include <net/ethernet.h>
64
65#include <netgraph/ng_message.h>
66#include <netgraph/netgraph.h>
67#include <netgraph/ng_parse.h>

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

166 },
167 {
168 NGM_ETHER_COOKIE,
169 NGM_ETHER_SET_AUTOSRC,
170 "setautosrc",
171 &ng_parse_int32_type,
172 NULL
173 },
61#include <net/if_types.h>
62#include <net/if_arp.h>
63#include <net/if_var.h>
64#include <net/ethernet.h>
65
66#include <netgraph/ng_message.h>
67#include <netgraph/netgraph.h>
68#include <netgraph/ng_parse.h>

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

167 },
168 {
169 NGM_ETHER_COOKIE,
170 NGM_ETHER_SET_AUTOSRC,
171 "setautosrc",
172 &ng_parse_int32_type,
173 NULL
174 },
175 {
176 NGM_ETHER_COOKIE,
177 NGM_ETHER_ADD_MULTI,
178 "addmulti",
179 &ng_parse_enaddr_type,
180 NULL
181 },
182 {
183 NGM_ETHER_COOKIE,
184 NGM_ETHER_DEL_MULTI,
185 "delmulti",
186 &ng_parse_enaddr_type,
187 NULL
188 },
174 { 0 }
175};
176
177static struct ng_type ng_ether_typestruct = {
178 .version = NG_ABI_VERSION,
179 .name = NG_ETHER_NODE_TYPE,
180 .mod_event = ng_ether_mod_event,
181 .constructor = ng_ether_constructor,

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

487 break;
488 case NGM_ETHER_SET_AUTOSRC:
489 if (msg->header.arglen != sizeof(u_int32_t)) {
490 error = EINVAL;
491 break;
492 }
493 priv->autoSrcAddr = !!*((u_int32_t *)msg->data);
494 break;
189 { 0 }
190};
191
192static struct ng_type ng_ether_typestruct = {
193 .version = NG_ABI_VERSION,
194 .name = NG_ETHER_NODE_TYPE,
195 .mod_event = ng_ether_mod_event,
196 .constructor = ng_ether_constructor,

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

502 break;
503 case NGM_ETHER_SET_AUTOSRC:
504 if (msg->header.arglen != sizeof(u_int32_t)) {
505 error = EINVAL;
506 break;
507 }
508 priv->autoSrcAddr = !!*((u_int32_t *)msg->data);
509 break;
510 case NGM_ETHER_ADD_MULTI:
511 {
512 struct sockaddr_dl sa_dl;
513 struct ifmultiaddr *ifm;
514
515 if (msg->header.arglen != ETHER_ADDR_LEN) {
516 error = EINVAL;
517 break;
518 }
519 sa_dl.sdl_len = sizeof(struct sockaddr_dl);
520 sa_dl.sdl_family = AF_LINK;
521 sa_dl.sdl_index = 0;
522 sa_dl.sdl_nlen = 0;
523 sa_dl.sdl_alen = 6;
524 sa_dl.sdl_slen = 0;
525 bcopy((void *)msg->data, LLADDR(&sa_dl),
526 ETHER_ADDR_LEN);
527 error = if_addmulti(priv->ifp,
528 (struct sockaddr *)&sa_dl, &ifm);
529 break;
530 }
531 case NGM_ETHER_DEL_MULTI:
532 {
533 struct sockaddr_dl sa_dl;
534
535 if (msg->header.arglen != ETHER_ADDR_LEN) {
536 error = EINVAL;
537 break;
538 }
539 sa_dl.sdl_len = sizeof(struct sockaddr_dl);
540 sa_dl.sdl_family = AF_LINK;
541 sa_dl.sdl_index = 0;
542 sa_dl.sdl_nlen = 0;
543 sa_dl.sdl_alen = 6;
544 sa_dl.sdl_slen = 0;
545 bcopy((void *)msg->data, LLADDR(&sa_dl),
546 ETHER_ADDR_LEN);
547 error = if_delmulti(priv->ifp,
548 (struct sockaddr *)&sa_dl);
549 break;
550 }
495 default:
496 error = EINVAL;
497 break;
498 }
499 break;
500 default:
501 error = EINVAL;
502 break;

--- 212 unchanged lines hidden ---
551 default:
552 error = EINVAL;
553 break;
554 }
555 break;
556 default:
557 error = EINVAL;
558 break;

--- 212 unchanged lines hidden ---