2 * m_pedit_eth.c packet editor: ETH header
4 * This program is free software; you can distribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Amir Vadai (amir@vadai.me)
17 #include <sys/socket.h>
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
26 parse_eth(int *argc_p
, char ***argv_p
,
27 struct m_pedit_sel
*sel
, struct m_pedit_key
*tkey
)
31 char **argv
= *argv_p
;
39 tkey
->htype
= TCA_PEDIT_KEY_EX_HDR_TYPE_ETH
;
41 if (strcmp(*argv
, "type") == 0) {
44 res
= parse_cmd(&argc
, &argv
, 2, TU32
, RU16
, sel
, tkey
);
48 if (strcmp(*argv
, "dst") == 0) {
51 res
= parse_cmd(&argc
, &argv
, 6, TMAC
, RU32
, sel
, tkey
);
55 if (strcmp(*argv
, "src") == 0) {
58 res
= parse_cmd(&argc
, &argv
, 6, TMAC
, RU32
, sel
, tkey
);
70 struct m_pedit_util p_pedit_eth
= {
72 .parse_peopt
= parse_eth
,