1ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf/* 2ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf * lib/route/cls/ematch/container.c Container Ematch 3ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf * 4ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf * This library is free software; you can redistribute it and/or 5ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf * modify it under the terms of the GNU Lesser General Public 6ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf * License as published by the Free Software Foundation version 2.1 7ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf * of the License. 8ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf * 9ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch> 10ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf */ 11ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf 12ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf#include <netlink-local.h> 13ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf#include <netlink-tc.h> 14ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf#include <netlink/netlink.h> 15ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf#include <netlink/route/cls/ematch.h> 16ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf 17ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Grafstatic int container_parse(struct rtnl_ematch *m, void *data, size_t len) 18ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf{ 19ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf memcpy(m->e_data, data, sizeof(uint32_t)); 20ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf 21ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf return 0; 22ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf} 23ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf 24ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Grafstatic struct rtnl_ematch_ops container_ops = { 25ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf .eo_kind = TCF_EM_CONTAINER, 26ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf .eo_name = "container", 27ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf .eo_datalen = sizeof(uint32_t), 28ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf .eo_parse = container_parse, 29ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf}; 30ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf 31ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Grafstatic void __init container_init(void) 32ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf{ 33ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf rtnl_ematch_register(&container_ops); 34ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf} 35ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf 36ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Grafstatic void __exit container_exit(void) 37ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf{ 38ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf rtnl_ematch_unregister(&container_ops); 39ef858fb492dfe98e3ae194264fbc73649cf8493aThomas Graf} 40