| 1 |
/// include script |
| 2 |
/// |
| 3 |
// Confidence: Low |
| 4 |
|
| 5 |
virtual patch |
| 6 |
virtual context |
| 7 |
virtual org |
| 8 |
virtual report |
| 9 |
|
| 10 |
@header@ |
| 11 |
@@ |
| 12 |
|
| 13 |
#include <linux/etherdevice.h> |
| 14 |
|
| 15 |
@eth_zero_addr depends on patch && !context && !org && !report@ |
| 16 |
expression e; |
| 17 |
@@ |
| 18 |
|
| 19 |
-memset(e,0,ETH_ALEN); |
| 20 |
+eth_zero_addr(e); |
| 21 |
|
| 22 |
@eth_broadcast_addr depends on patch && !context && !org && !report@ |
| 23 |
identifier e; |
| 24 |
@@ |
| 25 |
|
| 26 |
-memset(e,\(0xff\|0xFF\|255\),ETH_ALEN); |
| 27 |
+eth_broadcast_addr(e); |
| 28 |
|
| 29 |
|
| 30 |
@linux_header |
| 31 |
depends on !header && (eth_zero_addr || eth_broadcast_addr) && patch && !context && !org && !report |
| 32 |
@ |
| 33 |
@@ |
| 34 |
|
| 35 |
#include <linux/...> |
| 36 |
+ #include <linux/etherdevice.h> |
| 37 |
+ |
| 38 |
|
| 39 |
|
| 40 |
@special_header |
| 41 |
depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) && patch && !context && !org && !report |
| 42 |
@ |
| 43 |
@@ |
| 44 |
|
| 45 |
|
| 46 |
#include <.../...> |
| 47 |
+ |
| 48 |
+ #include <linux/etherdevice.h> |
| 49 |
+ |
| 50 |
|
| 51 |
@custom_header |
| 52 |
depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) && patch && !context && !org && !report |
| 53 |
@ |
| 54 |
@@ |
| 55 |
|
| 56 |
#include "..." |
| 57 |
+ |
| 58 |
+ #include <linux/etherdevice.h> |
| 59 |
|
| 60 |
// ---------------------------------------------------------------------------- |
| 61 |
|
| 62 |
@eth_zero_addr_context depends on !patch && (context || org || report)@ |
| 63 |
expression e; |
| 64 |
position j0; |
| 65 |
@@ |
| 66 |
|
| 67 |
* memset@j0(e,0,ETH_ALEN); |
| 68 |
|
| 69 |
@eth_broadcast_addr_context depends on !patch && (context || org || report)@ |
| 70 |
identifier e; |
| 71 |
position j0, j1; |
| 72 |
@@ |
| 73 |
|
| 74 |
* memset@j0(e,\(0xff@j1\|0xFF@j1\|255@j1\),ETH_ALEN); |
| 75 |
|
| 76 |
@linux_header_context |
| 77 |
depends on !header && (eth_zero_addr || eth_broadcast_addr) && !patch && (context || org || report) |
| 78 |
@ |
| 79 |
position j0; |
| 80 |
@@ |
| 81 |
|
| 82 |
* #include <linux/...>@j0 |
| 83 |
|
| 84 |
@special_header_context |
| 85 |
depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) && !patch && (context || org || report) |
| 86 |
@ |
| 87 |
position j0; |
| 88 |
@@ |
| 89 |
|
| 90 |
* #include <.../...>@j0 |
| 91 |
|
| 92 |
@custom_header_context |
| 93 |
depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) && !patch && (context || org || report) |
| 94 |
@ |
| 95 |
position j0; |
| 96 |
@@ |
| 97 |
|
| 98 |
* #include "..."@j0 |
| 99 |
|
| 100 |
// ---------------------------------------------------------------------------- |
| 101 |
|
| 102 |
@script:python eth_zero_addr_org depends on org@ |
| 103 |
j0 << eth_zero_addr_context.j0; |
| 104 |
@@ |
| 105 |
|
| 106 |
msg = "this is a rule." |
| 107 |
coccilib.org.print_todo(j0[0], msg) |
| 108 |
|
| 109 |
@script:python eth_broadcast_addr_org depends on org@ |
| 110 |
j0 << eth_broadcast_addr_context.j0; |
| 111 |
j1 << eth_broadcast_addr_context.j1; |
| 112 |
@@ |
| 113 |
|
| 114 |
msg = "this is antoher rule." |
| 115 |
coccilib.org.print_todo(j0[0], msg) |
| 116 |
coccilib.org.print_link(j1[0], "") |
| 117 |
|
| 118 |
@script:python linux_header_org depends on org@ |
| 119 |
j0 << linux_header_context.j0; |
| 120 |
@@ |
| 121 |
|
| 122 |
msg = "this is a third rule." |
| 123 |
coccilib.org.print_todo(j0[0], msg) |
| 124 |
|
| 125 |
@script:python special_header_org depends on org@ |
| 126 |
j0 << special_header_context.j0; |
| 127 |
@@ |
| 128 |
|
| 129 |
msg = "this is a special rule." |
| 130 |
coccilib.org.print_todo(j0[0], msg) |
| 131 |
|
| 132 |
@script:python custom_header_org depends on org@ |
| 133 |
j0 << custom_header_context.j0; |
| 134 |
@@ |
| 135 |
|
| 136 |
msg = "this is a custom rule." |
| 137 |
coccilib.org.print_todo(j0[0], msg) |
| 138 |
|
| 139 |
// ---------------------------------------------------------------------------- |
| 140 |
|
| 141 |
@script:python eth_zero_addr_report depends on report@ |
| 142 |
j0 << eth_zero_addr_context.j0; |
| 143 |
@@ |
| 144 |
|
| 145 |
msg = "this is a rule." |
| 146 |
coccilib.report.print_report(j0[0], msg) |
| 147 |
|
| 148 |
@script:python eth_broadcast_addr_report depends on report@ |
| 149 |
j0 << eth_broadcast_addr_context.j0; |
| 150 |
j1 << eth_broadcast_addr_context.j1; |
| 151 |
@@ |
| 152 |
|
| 153 |
msg = "this is antoher rule around line %s." % (j1[0].line) |
| 154 |
coccilib.report.print_report(j0[0], msg) |
| 155 |
|
| 156 |
@script:python linux_header_report depends on report@ |
| 157 |
j0 << linux_header_context.j0; |
| 158 |
@@ |
| 159 |
|
| 160 |
msg = "this is a third rule." |
| 161 |
coccilib.report.print_report(j0[0], msg) |
| 162 |
|
| 163 |
@script:python special_header_report depends on report@ |
| 164 |
j0 << special_header_context.j0; |
| 165 |
@@ |
| 166 |
|
| 167 |
msg = "this is a special rule." |
| 168 |
coccilib.report.print_report(j0[0], msg) |
| 169 |
|
| 170 |
@script:python custom_header_report depends on report@ |
| 171 |
j0 << custom_header_context.j0; |
| 172 |
@@ |
| 173 |
|
| 174 |
msg = "this is a custom rule." |
| 175 |
coccilib.report.print_report(j0[0], msg) |
| 176 |
|