| .. | .. |
|---|
| 60 | 60 | { |
|---|
| 61 | 61 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 62 | 62 | |
|---|
| 63 | | - if (!card) |
|---|
| 64 | | - return -EINVAL; |
|---|
| 65 | | - |
|---|
| 66 | 63 | return qeth_l3_dev_route_show(card, &card->options.route4, buf); |
|---|
| 67 | 64 | } |
|---|
| 68 | 65 | |
|---|
| .. | .. |
|---|
| 109 | 106 | { |
|---|
| 110 | 107 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 111 | 108 | |
|---|
| 112 | | - if (!card) |
|---|
| 113 | | - return -EINVAL; |
|---|
| 114 | | - |
|---|
| 115 | 109 | return qeth_l3_dev_route_store(card, &card->options.route4, |
|---|
| 116 | 110 | QETH_PROT_IPV4, buf, count); |
|---|
| 117 | 111 | } |
|---|
| .. | .. |
|---|
| 124 | 118 | { |
|---|
| 125 | 119 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 126 | 120 | |
|---|
| 127 | | - if (!card) |
|---|
| 128 | | - return -EINVAL; |
|---|
| 129 | | - |
|---|
| 130 | 121 | return qeth_l3_dev_route_show(card, &card->options.route6, buf); |
|---|
| 131 | 122 | } |
|---|
| 132 | 123 | |
|---|
| .. | .. |
|---|
| 135 | 126 | { |
|---|
| 136 | 127 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 137 | 128 | |
|---|
| 138 | | - if (!card) |
|---|
| 139 | | - return -EINVAL; |
|---|
| 140 | | - |
|---|
| 141 | 129 | return qeth_l3_dev_route_store(card, &card->options.route6, |
|---|
| 142 | 130 | QETH_PROT_IPV6, buf, count); |
|---|
| 143 | 131 | } |
|---|
| .. | .. |
|---|
| 145 | 133 | static DEVICE_ATTR(route6, 0644, qeth_l3_dev_route6_show, |
|---|
| 146 | 134 | qeth_l3_dev_route6_store); |
|---|
| 147 | 135 | |
|---|
| 148 | | -static ssize_t qeth_l3_dev_fake_broadcast_show(struct device *dev, |
|---|
| 149 | | - struct device_attribute *attr, char *buf) |
|---|
| 150 | | -{ |
|---|
| 151 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 152 | | - |
|---|
| 153 | | - if (!card) |
|---|
| 154 | | - return -EINVAL; |
|---|
| 155 | | - |
|---|
| 156 | | - return sprintf(buf, "%i\n", card->options.fake_broadcast? 1:0); |
|---|
| 157 | | -} |
|---|
| 158 | | - |
|---|
| 159 | | -static ssize_t qeth_l3_dev_fake_broadcast_store(struct device *dev, |
|---|
| 160 | | - struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 161 | | -{ |
|---|
| 162 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 163 | | - char *tmp; |
|---|
| 164 | | - int i, rc = 0; |
|---|
| 165 | | - |
|---|
| 166 | | - if (!card) |
|---|
| 167 | | - return -EINVAL; |
|---|
| 168 | | - |
|---|
| 169 | | - mutex_lock(&card->conf_mutex); |
|---|
| 170 | | - if ((card->state != CARD_STATE_DOWN) && |
|---|
| 171 | | - (card->state != CARD_STATE_RECOVER)) { |
|---|
| 172 | | - rc = -EPERM; |
|---|
| 173 | | - goto out; |
|---|
| 174 | | - } |
|---|
| 175 | | - |
|---|
| 176 | | - i = simple_strtoul(buf, &tmp, 16); |
|---|
| 177 | | - if ((i == 0) || (i == 1)) |
|---|
| 178 | | - card->options.fake_broadcast = i; |
|---|
| 179 | | - else |
|---|
| 180 | | - rc = -EINVAL; |
|---|
| 181 | | -out: |
|---|
| 182 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 183 | | - return rc ? rc : count; |
|---|
| 184 | | -} |
|---|
| 185 | | - |
|---|
| 186 | | -static DEVICE_ATTR(fake_broadcast, 0644, qeth_l3_dev_fake_broadcast_show, |
|---|
| 187 | | - qeth_l3_dev_fake_broadcast_store); |
|---|
| 188 | | - |
|---|
| 189 | 136 | static ssize_t qeth_l3_dev_sniffer_show(struct device *dev, |
|---|
| 190 | 137 | struct device_attribute *attr, char *buf) |
|---|
| 191 | 138 | { |
|---|
| 192 | 139 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 193 | | - |
|---|
| 194 | | - if (!card) |
|---|
| 195 | | - return -EINVAL; |
|---|
| 196 | 140 | |
|---|
| 197 | 141 | return sprintf(buf, "%i\n", card->options.sniffer ? 1 : 0); |
|---|
| 198 | 142 | } |
|---|
| .. | .. |
|---|
| 204 | 148 | int rc = 0; |
|---|
| 205 | 149 | unsigned long i; |
|---|
| 206 | 150 | |
|---|
| 207 | | - if (!card) |
|---|
| 208 | | - return -EINVAL; |
|---|
| 209 | | - |
|---|
| 210 | | - if (card->info.type != QETH_CARD_TYPE_IQD) |
|---|
| 151 | + if (!IS_IQD(card)) |
|---|
| 211 | 152 | return -EPERM; |
|---|
| 212 | 153 | if (card->options.cq == QETH_CQ_ENABLED) |
|---|
| 213 | 154 | return -EPERM; |
|---|
| 214 | 155 | |
|---|
| 215 | 156 | mutex_lock(&card->conf_mutex); |
|---|
| 216 | | - if ((card->state != CARD_STATE_DOWN) && |
|---|
| 217 | | - (card->state != CARD_STATE_RECOVER)) { |
|---|
| 157 | + if (card->state != CARD_STATE_DOWN) { |
|---|
| 218 | 158 | rc = -EPERM; |
|---|
| 219 | 159 | goto out; |
|---|
| 220 | 160 | } |
|---|
| .. | .. |
|---|
| 230 | 170 | break; |
|---|
| 231 | 171 | case 1: |
|---|
| 232 | 172 | qdio_get_ssqd_desc(CARD_DDEV(card), &card->ssqd); |
|---|
| 233 | | - if (card->ssqd.qdioac2 & QETH_SNIFF_AVAIL) { |
|---|
| 173 | + if (card->ssqd.qdioac2 & CHSC_AC2_SNIFFER_AVAILABLE) { |
|---|
| 234 | 174 | card->options.sniffer = i; |
|---|
| 235 | | - if (card->qdio.init_pool.buf_count != |
|---|
| 236 | | - QETH_IN_BUF_COUNT_MAX) |
|---|
| 237 | | - qeth_realloc_buffer_pool(card, |
|---|
| 238 | | - QETH_IN_BUF_COUNT_MAX); |
|---|
| 239 | | - } else |
|---|
| 175 | + qeth_resize_buffer_pool(card, QETH_IN_BUF_COUNT_MAX); |
|---|
| 176 | + } else { |
|---|
| 240 | 177 | rc = -EPERM; |
|---|
| 178 | + } |
|---|
| 179 | + |
|---|
| 241 | 180 | break; |
|---|
| 242 | 181 | default: |
|---|
| 243 | 182 | rc = -EINVAL; |
|---|
| .. | .. |
|---|
| 250 | 189 | static DEVICE_ATTR(sniffer, 0644, qeth_l3_dev_sniffer_show, |
|---|
| 251 | 190 | qeth_l3_dev_sniffer_store); |
|---|
| 252 | 191 | |
|---|
| 253 | | - |
|---|
| 254 | 192 | static ssize_t qeth_l3_dev_hsuid_show(struct device *dev, |
|---|
| 255 | 193 | struct device_attribute *attr, char *buf) |
|---|
| 256 | 194 | { |
|---|
| 257 | 195 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 258 | 196 | char tmp_hsuid[9]; |
|---|
| 259 | 197 | |
|---|
| 260 | | - if (!card) |
|---|
| 261 | | - return -EINVAL; |
|---|
| 262 | | - |
|---|
| 263 | | - if (card->info.type != QETH_CARD_TYPE_IQD) |
|---|
| 198 | + if (!IS_IQD(card)) |
|---|
| 264 | 199 | return -EPERM; |
|---|
| 265 | 200 | |
|---|
| 266 | 201 | memcpy(tmp_hsuid, card->options.hsuid, sizeof(tmp_hsuid)); |
|---|
| .. | .. |
|---|
| 272 | 207 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 273 | 208 | { |
|---|
| 274 | 209 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 210 | + int rc = 0; |
|---|
| 275 | 211 | char *tmp; |
|---|
| 276 | | - int rc; |
|---|
| 277 | 212 | |
|---|
| 278 | | - if (!card) |
|---|
| 279 | | - return -EINVAL; |
|---|
| 213 | + if (!IS_IQD(card)) |
|---|
| 214 | + return -EPERM; |
|---|
| 280 | 215 | |
|---|
| 281 | | - if (card->info.type != QETH_CARD_TYPE_IQD) |
|---|
| 282 | | - return -EPERM; |
|---|
| 283 | | - if (card->state != CARD_STATE_DOWN && |
|---|
| 284 | | - card->state != CARD_STATE_RECOVER) |
|---|
| 285 | | - return -EPERM; |
|---|
| 286 | | - if (card->options.sniffer) |
|---|
| 287 | | - return -EPERM; |
|---|
| 288 | | - if (card->options.cq == QETH_CQ_NOTAVAILABLE) |
|---|
| 289 | | - return -EPERM; |
|---|
| 216 | + mutex_lock(&card->conf_mutex); |
|---|
| 217 | + if (card->state != CARD_STATE_DOWN) { |
|---|
| 218 | + rc = -EPERM; |
|---|
| 219 | + goto out; |
|---|
| 220 | + } |
|---|
| 221 | + |
|---|
| 222 | + if (card->options.sniffer) { |
|---|
| 223 | + rc = -EPERM; |
|---|
| 224 | + goto out; |
|---|
| 225 | + } |
|---|
| 226 | + |
|---|
| 227 | + if (card->options.cq == QETH_CQ_NOTAVAILABLE) { |
|---|
| 228 | + rc = -EPERM; |
|---|
| 229 | + goto out; |
|---|
| 230 | + } |
|---|
| 290 | 231 | |
|---|
| 291 | 232 | tmp = strsep((char **)&buf, "\n"); |
|---|
| 292 | | - if (strlen(tmp) > 8) |
|---|
| 293 | | - return -EINVAL; |
|---|
| 233 | + if (strlen(tmp) > 8) { |
|---|
| 234 | + rc = -EINVAL; |
|---|
| 235 | + goto out; |
|---|
| 236 | + } |
|---|
| 294 | 237 | |
|---|
| 295 | 238 | if (card->options.hsuid[0]) |
|---|
| 296 | 239 | /* delete old ip address */ |
|---|
| .. | .. |
|---|
| 301 | 244 | card->options.hsuid[0] = '\0'; |
|---|
| 302 | 245 | memcpy(card->dev->perm_addr, card->options.hsuid, 9); |
|---|
| 303 | 246 | qeth_configure_cq(card, QETH_CQ_DISABLED); |
|---|
| 304 | | - return count; |
|---|
| 247 | + goto out; |
|---|
| 305 | 248 | } |
|---|
| 306 | 249 | |
|---|
| 307 | | - if (qeth_configure_cq(card, QETH_CQ_ENABLED)) |
|---|
| 308 | | - return -EPERM; |
|---|
| 250 | + if (qeth_configure_cq(card, QETH_CQ_ENABLED)) { |
|---|
| 251 | + rc = -EPERM; |
|---|
| 252 | + goto out; |
|---|
| 253 | + } |
|---|
| 309 | 254 | |
|---|
| 310 | 255 | snprintf(card->options.hsuid, sizeof(card->options.hsuid), |
|---|
| 311 | 256 | "%-8s", tmp); |
|---|
| .. | .. |
|---|
| 314 | 259 | |
|---|
| 315 | 260 | rc = qeth_l3_modify_hsuid(card, true); |
|---|
| 316 | 261 | |
|---|
| 262 | +out: |
|---|
| 263 | + mutex_unlock(&card->conf_mutex); |
|---|
| 317 | 264 | return rc ? rc : count; |
|---|
| 318 | 265 | } |
|---|
| 319 | 266 | |
|---|
| .. | .. |
|---|
| 324 | 271 | static struct attribute *qeth_l3_device_attrs[] = { |
|---|
| 325 | 272 | &dev_attr_route4.attr, |
|---|
| 326 | 273 | &dev_attr_route6.attr, |
|---|
| 327 | | - &dev_attr_fake_broadcast.attr, |
|---|
| 328 | 274 | &dev_attr_sniffer.attr, |
|---|
| 329 | 275 | &dev_attr_hsuid.attr, |
|---|
| 330 | 276 | NULL, |
|---|
| .. | .. |
|---|
| 339 | 285 | { |
|---|
| 340 | 286 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 341 | 287 | |
|---|
| 342 | | - if (!card) |
|---|
| 343 | | - return -EINVAL; |
|---|
| 344 | | - |
|---|
| 345 | | - return sprintf(buf, "%i\n", card->ipato.enabled? 1:0); |
|---|
| 288 | + return sprintf(buf, "%u\n", card->ipato.enabled ? 1 : 0); |
|---|
| 346 | 289 | } |
|---|
| 347 | 290 | |
|---|
| 348 | 291 | static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev, |
|---|
| .. | .. |
|---|
| 352 | 295 | bool enable; |
|---|
| 353 | 296 | int rc = 0; |
|---|
| 354 | 297 | |
|---|
| 355 | | - if (!card) |
|---|
| 356 | | - return -EINVAL; |
|---|
| 357 | | - |
|---|
| 358 | 298 | mutex_lock(&card->conf_mutex); |
|---|
| 359 | | - if ((card->state != CARD_STATE_DOWN) && |
|---|
| 360 | | - (card->state != CARD_STATE_RECOVER)) { |
|---|
| 299 | + if (card->state != CARD_STATE_DOWN) { |
|---|
| 361 | 300 | rc = -EPERM; |
|---|
| 362 | 301 | goto out; |
|---|
| 363 | 302 | } |
|---|
| 364 | 303 | |
|---|
| 304 | + mutex_lock(&card->ip_lock); |
|---|
| 365 | 305 | if (sysfs_streq(buf, "toggle")) { |
|---|
| 366 | 306 | enable = !card->ipato.enabled; |
|---|
| 367 | 307 | } else if (kstrtobool(buf, &enable)) { |
|---|
| 368 | 308 | rc = -EINVAL; |
|---|
| 369 | | - goto out; |
|---|
| 309 | + goto unlock_ip; |
|---|
| 370 | 310 | } |
|---|
| 371 | 311 | |
|---|
| 372 | 312 | if (card->ipato.enabled != enable) { |
|---|
| 373 | 313 | card->ipato.enabled = enable; |
|---|
| 374 | | - spin_lock_bh(&card->ip_lock); |
|---|
| 375 | 314 | qeth_l3_update_ipato(card); |
|---|
| 376 | | - spin_unlock_bh(&card->ip_lock); |
|---|
| 377 | 315 | } |
|---|
| 316 | + |
|---|
| 317 | +unlock_ip: |
|---|
| 318 | + mutex_unlock(&card->ip_lock); |
|---|
| 378 | 319 | out: |
|---|
| 379 | 320 | mutex_unlock(&card->conf_mutex); |
|---|
| 380 | 321 | return rc ? rc : count; |
|---|
| .. | .. |
|---|
| 389 | 330 | { |
|---|
| 390 | 331 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 391 | 332 | |
|---|
| 392 | | - if (!card) |
|---|
| 393 | | - return -EINVAL; |
|---|
| 394 | | - |
|---|
| 395 | | - return sprintf(buf, "%i\n", card->ipato.invert4? 1:0); |
|---|
| 333 | + return sprintf(buf, "%u\n", card->ipato.invert4 ? 1 : 0); |
|---|
| 396 | 334 | } |
|---|
| 397 | 335 | |
|---|
| 398 | 336 | static ssize_t qeth_l3_dev_ipato_invert4_store(struct device *dev, |
|---|
| .. | .. |
|---|
| 403 | 341 | bool invert; |
|---|
| 404 | 342 | int rc = 0; |
|---|
| 405 | 343 | |
|---|
| 406 | | - if (!card) |
|---|
| 407 | | - return -EINVAL; |
|---|
| 408 | | - |
|---|
| 409 | | - mutex_lock(&card->conf_mutex); |
|---|
| 344 | + mutex_lock(&card->ip_lock); |
|---|
| 410 | 345 | if (sysfs_streq(buf, "toggle")) { |
|---|
| 411 | 346 | invert = !card->ipato.invert4; |
|---|
| 412 | 347 | } else if (kstrtobool(buf, &invert)) { |
|---|
| .. | .. |
|---|
| 416 | 351 | |
|---|
| 417 | 352 | if (card->ipato.invert4 != invert) { |
|---|
| 418 | 353 | card->ipato.invert4 = invert; |
|---|
| 419 | | - spin_lock_bh(&card->ip_lock); |
|---|
| 420 | 354 | qeth_l3_update_ipato(card); |
|---|
| 421 | | - spin_unlock_bh(&card->ip_lock); |
|---|
| 422 | 355 | } |
|---|
| 356 | + |
|---|
| 423 | 357 | out: |
|---|
| 424 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 358 | + mutex_unlock(&card->ip_lock); |
|---|
| 425 | 359 | return rc ? rc : count; |
|---|
| 426 | 360 | } |
|---|
| 427 | 361 | |
|---|
| .. | .. |
|---|
| 433 | 367 | enum qeth_prot_versions proto) |
|---|
| 434 | 368 | { |
|---|
| 435 | 369 | struct qeth_ipato_entry *ipatoe; |
|---|
| 436 | | - char addr_str[40]; |
|---|
| 437 | | - int entry_len; /* length of 1 entry string, differs between v4 and v6 */ |
|---|
| 438 | | - int i = 0; |
|---|
| 370 | + int str_len = 0; |
|---|
| 439 | 371 | |
|---|
| 440 | | - entry_len = (proto == QETH_PROT_IPV4)? 12 : 40; |
|---|
| 441 | | - /* add strlen for "/<mask>\n" */ |
|---|
| 442 | | - entry_len += (proto == QETH_PROT_IPV4)? 5 : 6; |
|---|
| 443 | | - spin_lock_bh(&card->ip_lock); |
|---|
| 372 | + mutex_lock(&card->ip_lock); |
|---|
| 444 | 373 | list_for_each_entry(ipatoe, &card->ipato.entries, entry) { |
|---|
| 374 | + char addr_str[40]; |
|---|
| 375 | + int entry_len; |
|---|
| 376 | + |
|---|
| 445 | 377 | if (ipatoe->proto != proto) |
|---|
| 446 | 378 | continue; |
|---|
| 447 | | - /* String must not be longer than PAGE_SIZE. So we check if |
|---|
| 448 | | - * string length gets near PAGE_SIZE. Then we can savely display |
|---|
| 449 | | - * the next IPv6 address (worst case, compared to IPv4) */ |
|---|
| 450 | | - if ((PAGE_SIZE - i) <= entry_len) |
|---|
| 451 | | - break; |
|---|
| 452 | | - qeth_l3_ipaddr_to_string(proto, ipatoe->addr, addr_str); |
|---|
| 453 | | - i += snprintf(buf + i, PAGE_SIZE - i, |
|---|
| 454 | | - "%s/%i\n", addr_str, ipatoe->mask_bits); |
|---|
| 455 | | - } |
|---|
| 456 | | - spin_unlock_bh(&card->ip_lock); |
|---|
| 457 | | - i += snprintf(buf + i, PAGE_SIZE - i, "\n"); |
|---|
| 458 | 379 | |
|---|
| 459 | | - return i; |
|---|
| 380 | + entry_len = qeth_l3_ipaddr_to_string(proto, ipatoe->addr, |
|---|
| 381 | + addr_str); |
|---|
| 382 | + if (entry_len < 0) |
|---|
| 383 | + continue; |
|---|
| 384 | + |
|---|
| 385 | + /* Append /%mask to the entry: */ |
|---|
| 386 | + entry_len += 1 + ((proto == QETH_PROT_IPV4) ? 2 : 3); |
|---|
| 387 | + /* Enough room to format %entry\n into null terminated page? */ |
|---|
| 388 | + if (entry_len + 1 > PAGE_SIZE - str_len - 1) |
|---|
| 389 | + break; |
|---|
| 390 | + |
|---|
| 391 | + entry_len = scnprintf(buf, PAGE_SIZE - str_len, |
|---|
| 392 | + "%s/%i\n", addr_str, ipatoe->mask_bits); |
|---|
| 393 | + str_len += entry_len; |
|---|
| 394 | + buf += entry_len; |
|---|
| 395 | + } |
|---|
| 396 | + mutex_unlock(&card->ip_lock); |
|---|
| 397 | + |
|---|
| 398 | + return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n"); |
|---|
| 460 | 399 | } |
|---|
| 461 | 400 | |
|---|
| 462 | 401 | static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev, |
|---|
| .. | .. |
|---|
| 464 | 403 | { |
|---|
| 465 | 404 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 466 | 405 | |
|---|
| 467 | | - if (!card) |
|---|
| 468 | | - return -EINVAL; |
|---|
| 469 | | - |
|---|
| 470 | 406 | return qeth_l3_dev_ipato_add_show(buf, card, QETH_PROT_IPV4); |
|---|
| 471 | 407 | } |
|---|
| 472 | 408 | |
|---|
| 473 | 409 | static int qeth_l3_parse_ipatoe(const char *buf, enum qeth_prot_versions proto, |
|---|
| 474 | | - u8 *addr, int *mask_bits) |
|---|
| 410 | + u8 *addr, unsigned int *mask_bits) |
|---|
| 475 | 411 | { |
|---|
| 476 | | - const char *start, *end; |
|---|
| 477 | | - char *tmp; |
|---|
| 478 | | - char buffer[40] = {0, }; |
|---|
| 412 | + char *sep; |
|---|
| 413 | + int rc; |
|---|
| 479 | 414 | |
|---|
| 480 | | - start = buf; |
|---|
| 481 | | - /* get address string */ |
|---|
| 482 | | - end = strchr(start, '/'); |
|---|
| 483 | | - if (!end || (end - start >= 40)) { |
|---|
| 415 | + /* Expected input pattern: %addr/%mask */ |
|---|
| 416 | + sep = strnchr(buf, 40, '/'); |
|---|
| 417 | + if (!sep) |
|---|
| 484 | 418 | return -EINVAL; |
|---|
| 485 | | - } |
|---|
| 486 | | - strncpy(buffer, start, end - start); |
|---|
| 487 | | - if (qeth_l3_string_to_ipaddr(buffer, proto, addr)) { |
|---|
| 419 | + |
|---|
| 420 | + /* Terminate the %addr sub-string, and parse it: */ |
|---|
| 421 | + *sep = '\0'; |
|---|
| 422 | + rc = qeth_l3_string_to_ipaddr(buf, proto, addr); |
|---|
| 423 | + if (rc) |
|---|
| 424 | + return rc; |
|---|
| 425 | + |
|---|
| 426 | + rc = kstrtouint(sep + 1, 10, mask_bits); |
|---|
| 427 | + if (rc) |
|---|
| 428 | + return rc; |
|---|
| 429 | + |
|---|
| 430 | + if (*mask_bits > ((proto == QETH_PROT_IPV4) ? 32 : 128)) |
|---|
| 488 | 431 | return -EINVAL; |
|---|
| 489 | | - } |
|---|
| 490 | | - start = end + 1; |
|---|
| 491 | | - *mask_bits = simple_strtoul(start, &tmp, 10); |
|---|
| 492 | | - if (!strlen(start) || |
|---|
| 493 | | - (tmp == start) || |
|---|
| 494 | | - (*mask_bits > ((proto == QETH_PROT_IPV4) ? 32 : 128))) { |
|---|
| 495 | | - return -EINVAL; |
|---|
| 496 | | - } |
|---|
| 432 | + |
|---|
| 497 | 433 | return 0; |
|---|
| 498 | 434 | } |
|---|
| 499 | 435 | |
|---|
| .. | .. |
|---|
| 501 | 437 | struct qeth_card *card, enum qeth_prot_versions proto) |
|---|
| 502 | 438 | { |
|---|
| 503 | 439 | struct qeth_ipato_entry *ipatoe; |
|---|
| 440 | + unsigned int mask_bits; |
|---|
| 504 | 441 | u8 addr[16]; |
|---|
| 505 | | - int mask_bits; |
|---|
| 506 | 442 | int rc = 0; |
|---|
| 507 | 443 | |
|---|
| 508 | | - mutex_lock(&card->conf_mutex); |
|---|
| 509 | 444 | rc = qeth_l3_parse_ipatoe(buf, proto, addr, &mask_bits); |
|---|
| 510 | 445 | if (rc) |
|---|
| 511 | | - goto out; |
|---|
| 446 | + return rc; |
|---|
| 512 | 447 | |
|---|
| 513 | 448 | ipatoe = kzalloc(sizeof(struct qeth_ipato_entry), GFP_KERNEL); |
|---|
| 514 | | - if (!ipatoe) { |
|---|
| 515 | | - rc = -ENOMEM; |
|---|
| 516 | | - goto out; |
|---|
| 517 | | - } |
|---|
| 449 | + if (!ipatoe) |
|---|
| 450 | + return -ENOMEM; |
|---|
| 451 | + |
|---|
| 518 | 452 | ipatoe->proto = proto; |
|---|
| 519 | | - memcpy(ipatoe->addr, addr, (proto == QETH_PROT_IPV4)? 4:16); |
|---|
| 453 | + memcpy(ipatoe->addr, addr, (proto == QETH_PROT_IPV4) ? 4 : 16); |
|---|
| 520 | 454 | ipatoe->mask_bits = mask_bits; |
|---|
| 521 | 455 | |
|---|
| 522 | 456 | rc = qeth_l3_add_ipato_entry(card, ipatoe); |
|---|
| 523 | 457 | if (rc) |
|---|
| 524 | 458 | kfree(ipatoe); |
|---|
| 525 | | -out: |
|---|
| 526 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 459 | + |
|---|
| 527 | 460 | return rc ? rc : count; |
|---|
| 528 | 461 | } |
|---|
| 529 | 462 | |
|---|
| .. | .. |
|---|
| 531 | 464 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 532 | 465 | { |
|---|
| 533 | 466 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 534 | | - |
|---|
| 535 | | - if (!card) |
|---|
| 536 | | - return -EINVAL; |
|---|
| 537 | 467 | |
|---|
| 538 | 468 | return qeth_l3_dev_ipato_add_store(buf, count, card, QETH_PROT_IPV4); |
|---|
| 539 | 469 | } |
|---|
| .. | .. |
|---|
| 545 | 475 | static ssize_t qeth_l3_dev_ipato_del_store(const char *buf, size_t count, |
|---|
| 546 | 476 | struct qeth_card *card, enum qeth_prot_versions proto) |
|---|
| 547 | 477 | { |
|---|
| 478 | + unsigned int mask_bits; |
|---|
| 548 | 479 | u8 addr[16]; |
|---|
| 549 | | - int mask_bits; |
|---|
| 550 | 480 | int rc = 0; |
|---|
| 551 | 481 | |
|---|
| 552 | | - mutex_lock(&card->conf_mutex); |
|---|
| 553 | 482 | rc = qeth_l3_parse_ipatoe(buf, proto, addr, &mask_bits); |
|---|
| 554 | 483 | if (!rc) |
|---|
| 555 | 484 | rc = qeth_l3_del_ipato_entry(card, proto, addr, mask_bits); |
|---|
| 556 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 557 | 485 | return rc ? rc : count; |
|---|
| 558 | 486 | } |
|---|
| 559 | 487 | |
|---|
| .. | .. |
|---|
| 561 | 489 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 562 | 490 | { |
|---|
| 563 | 491 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 564 | | - |
|---|
| 565 | | - if (!card) |
|---|
| 566 | | - return -EINVAL; |
|---|
| 567 | 492 | |
|---|
| 568 | 493 | return qeth_l3_dev_ipato_del_store(buf, count, card, QETH_PROT_IPV4); |
|---|
| 569 | 494 | } |
|---|
| .. | .. |
|---|
| 576 | 501 | { |
|---|
| 577 | 502 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 578 | 503 | |
|---|
| 579 | | - if (!card) |
|---|
| 580 | | - return -EINVAL; |
|---|
| 581 | | - |
|---|
| 582 | | - return sprintf(buf, "%i\n", card->ipato.invert6? 1:0); |
|---|
| 504 | + return sprintf(buf, "%u\n", card->ipato.invert6 ? 1 : 0); |
|---|
| 583 | 505 | } |
|---|
| 584 | 506 | |
|---|
| 585 | 507 | static ssize_t qeth_l3_dev_ipato_invert6_store(struct device *dev, |
|---|
| .. | .. |
|---|
| 589 | 511 | bool invert; |
|---|
| 590 | 512 | int rc = 0; |
|---|
| 591 | 513 | |
|---|
| 592 | | - if (!card) |
|---|
| 593 | | - return -EINVAL; |
|---|
| 594 | | - |
|---|
| 595 | | - mutex_lock(&card->conf_mutex); |
|---|
| 514 | + mutex_lock(&card->ip_lock); |
|---|
| 596 | 515 | if (sysfs_streq(buf, "toggle")) { |
|---|
| 597 | 516 | invert = !card->ipato.invert6; |
|---|
| 598 | 517 | } else if (kstrtobool(buf, &invert)) { |
|---|
| .. | .. |
|---|
| 602 | 521 | |
|---|
| 603 | 522 | if (card->ipato.invert6 != invert) { |
|---|
| 604 | 523 | card->ipato.invert6 = invert; |
|---|
| 605 | | - spin_lock_bh(&card->ip_lock); |
|---|
| 606 | 524 | qeth_l3_update_ipato(card); |
|---|
| 607 | | - spin_unlock_bh(&card->ip_lock); |
|---|
| 608 | 525 | } |
|---|
| 526 | + |
|---|
| 609 | 527 | out: |
|---|
| 610 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 528 | + mutex_unlock(&card->ip_lock); |
|---|
| 611 | 529 | return rc ? rc : count; |
|---|
| 612 | 530 | } |
|---|
| 613 | 531 | |
|---|
| .. | .. |
|---|
| 621 | 539 | { |
|---|
| 622 | 540 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 623 | 541 | |
|---|
| 624 | | - if (!card) |
|---|
| 625 | | - return -EINVAL; |
|---|
| 626 | | - |
|---|
| 627 | 542 | return qeth_l3_dev_ipato_add_show(buf, card, QETH_PROT_IPV6); |
|---|
| 628 | 543 | } |
|---|
| 629 | 544 | |
|---|
| .. | .. |
|---|
| 631 | 546 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 632 | 547 | { |
|---|
| 633 | 548 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 634 | | - |
|---|
| 635 | | - if (!card) |
|---|
| 636 | | - return -EINVAL; |
|---|
| 637 | 549 | |
|---|
| 638 | 550 | return qeth_l3_dev_ipato_add_store(buf, count, card, QETH_PROT_IPV6); |
|---|
| 639 | 551 | } |
|---|
| .. | .. |
|---|
| 646 | 558 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 647 | 559 | { |
|---|
| 648 | 560 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 649 | | - |
|---|
| 650 | | - if (!card) |
|---|
| 651 | | - return -EINVAL; |
|---|
| 652 | 561 | |
|---|
| 653 | 562 | return qeth_l3_dev_ipato_del_store(buf, count, card, QETH_PROT_IPV6); |
|---|
| 654 | 563 | } |
|---|
| .. | .. |
|---|
| 678 | 587 | { |
|---|
| 679 | 588 | struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 680 | 589 | struct qeth_ipaddr *ipaddr; |
|---|
| 681 | | - char addr_str[40]; |
|---|
| 682 | 590 | int str_len = 0; |
|---|
| 683 | | - int entry_len; /* length of 1 entry string, differs between v4 and v6 */ |
|---|
| 684 | 591 | int i; |
|---|
| 685 | 592 | |
|---|
| 686 | | - if (!card) |
|---|
| 687 | | - return -EINVAL; |
|---|
| 688 | | - |
|---|
| 689 | | - entry_len = (proto == QETH_PROT_IPV4)? 12 : 40; |
|---|
| 690 | | - entry_len += 2; /* \n + terminator */ |
|---|
| 691 | | - spin_lock_bh(&card->ip_lock); |
|---|
| 593 | + mutex_lock(&card->ip_lock); |
|---|
| 692 | 594 | hash_for_each(card->ip_htable, i, ipaddr, hnode) { |
|---|
| 595 | + char addr_str[40]; |
|---|
| 596 | + int entry_len; |
|---|
| 597 | + |
|---|
| 693 | 598 | if (ipaddr->proto != proto || ipaddr->type != type) |
|---|
| 694 | 599 | continue; |
|---|
| 695 | | - /* String must not be longer than PAGE_SIZE. So we check if |
|---|
| 696 | | - * string length gets near PAGE_SIZE. Then we can savely display |
|---|
| 697 | | - * the next IPv6 address (worst case, compared to IPv4) */ |
|---|
| 698 | | - if ((PAGE_SIZE - str_len) <= entry_len) |
|---|
| 699 | | - break; |
|---|
| 700 | | - qeth_l3_ipaddr_to_string(proto, (const u8 *)&ipaddr->u, |
|---|
| 701 | | - addr_str); |
|---|
| 702 | | - str_len += snprintf(buf + str_len, PAGE_SIZE - str_len, "%s\n", |
|---|
| 703 | | - addr_str); |
|---|
| 704 | | - } |
|---|
| 705 | | - spin_unlock_bh(&card->ip_lock); |
|---|
| 706 | | - str_len += snprintf(buf + str_len, PAGE_SIZE - str_len, "\n"); |
|---|
| 707 | 600 | |
|---|
| 708 | | - return str_len; |
|---|
| 601 | + entry_len = qeth_l3_ipaddr_to_string(proto, (u8 *)&ipaddr->u, |
|---|
| 602 | + addr_str); |
|---|
| 603 | + if (entry_len < 0) |
|---|
| 604 | + continue; |
|---|
| 605 | + |
|---|
| 606 | + /* Enough room to format %addr\n into null terminated page? */ |
|---|
| 607 | + if (entry_len + 1 > PAGE_SIZE - str_len - 1) |
|---|
| 608 | + break; |
|---|
| 609 | + |
|---|
| 610 | + entry_len = scnprintf(buf, PAGE_SIZE - str_len, "%s\n", |
|---|
| 611 | + addr_str); |
|---|
| 612 | + str_len += entry_len; |
|---|
| 613 | + buf += entry_len; |
|---|
| 614 | + } |
|---|
| 615 | + mutex_unlock(&card->ip_lock); |
|---|
| 616 | + |
|---|
| 617 | + return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n"); |
|---|
| 709 | 618 | } |
|---|
| 710 | 619 | |
|---|
| 711 | 620 | static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev, |
|---|
| .. | .. |
|---|
| 716 | 625 | QETH_IP_TYPE_VIPA); |
|---|
| 717 | 626 | } |
|---|
| 718 | 627 | |
|---|
| 719 | | -static int qeth_l3_parse_vipae(const char *buf, enum qeth_prot_versions proto, |
|---|
| 720 | | - u8 *addr) |
|---|
| 628 | +static ssize_t qeth_l3_vipa_store(struct device *dev, const char *buf, bool add, |
|---|
| 629 | + size_t count, enum qeth_prot_versions proto) |
|---|
| 721 | 630 | { |
|---|
| 722 | | - if (qeth_l3_string_to_ipaddr(buf, proto, addr)) { |
|---|
| 723 | | - return -EINVAL; |
|---|
| 724 | | - } |
|---|
| 725 | | - return 0; |
|---|
| 726 | | -} |
|---|
| 727 | | - |
|---|
| 728 | | -static ssize_t qeth_l3_dev_vipa_add_store(const char *buf, size_t count, |
|---|
| 729 | | - struct qeth_card *card, enum qeth_prot_versions proto) |
|---|
| 730 | | -{ |
|---|
| 631 | + struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 731 | 632 | u8 addr[16] = {0, }; |
|---|
| 732 | 633 | int rc; |
|---|
| 733 | 634 | |
|---|
| 734 | | - mutex_lock(&card->conf_mutex); |
|---|
| 735 | | - rc = qeth_l3_parse_vipae(buf, proto, addr); |
|---|
| 635 | + rc = qeth_l3_string_to_ipaddr(buf, proto, addr); |
|---|
| 736 | 636 | if (!rc) |
|---|
| 737 | | - rc = qeth_l3_modify_rxip_vipa(card, true, addr, |
|---|
| 637 | + rc = qeth_l3_modify_rxip_vipa(card, add, addr, |
|---|
| 738 | 638 | QETH_IP_TYPE_VIPA, proto); |
|---|
| 739 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 740 | 639 | return rc ? rc : count; |
|---|
| 741 | 640 | } |
|---|
| 742 | 641 | |
|---|
| 743 | 642 | static ssize_t qeth_l3_dev_vipa_add4_store(struct device *dev, |
|---|
| 744 | 643 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 745 | 644 | { |
|---|
| 746 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 747 | | - |
|---|
| 748 | | - if (!card) |
|---|
| 749 | | - return -EINVAL; |
|---|
| 750 | | - |
|---|
| 751 | | - return qeth_l3_dev_vipa_add_store(buf, count, card, QETH_PROT_IPV4); |
|---|
| 645 | + return qeth_l3_vipa_store(dev, buf, true, count, QETH_PROT_IPV4); |
|---|
| 752 | 646 | } |
|---|
| 753 | 647 | |
|---|
| 754 | 648 | static QETH_DEVICE_ATTR(vipa_add4, add4, 0644, |
|---|
| 755 | 649 | qeth_l3_dev_vipa_add4_show, |
|---|
| 756 | 650 | qeth_l3_dev_vipa_add4_store); |
|---|
| 757 | 651 | |
|---|
| 758 | | -static ssize_t qeth_l3_dev_vipa_del_store(const char *buf, size_t count, |
|---|
| 759 | | - struct qeth_card *card, enum qeth_prot_versions proto) |
|---|
| 760 | | -{ |
|---|
| 761 | | - u8 addr[16]; |
|---|
| 762 | | - int rc; |
|---|
| 763 | | - |
|---|
| 764 | | - mutex_lock(&card->conf_mutex); |
|---|
| 765 | | - rc = qeth_l3_parse_vipae(buf, proto, addr); |
|---|
| 766 | | - if (!rc) |
|---|
| 767 | | - rc = qeth_l3_modify_rxip_vipa(card, false, addr, |
|---|
| 768 | | - QETH_IP_TYPE_VIPA, proto); |
|---|
| 769 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 770 | | - return rc ? rc : count; |
|---|
| 771 | | -} |
|---|
| 772 | | - |
|---|
| 773 | 652 | static ssize_t qeth_l3_dev_vipa_del4_store(struct device *dev, |
|---|
| 774 | 653 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 775 | 654 | { |
|---|
| 776 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 777 | | - |
|---|
| 778 | | - if (!card) |
|---|
| 779 | | - return -EINVAL; |
|---|
| 780 | | - |
|---|
| 781 | | - return qeth_l3_dev_vipa_del_store(buf, count, card, QETH_PROT_IPV4); |
|---|
| 655 | + return qeth_l3_vipa_store(dev, buf, false, count, QETH_PROT_IPV4); |
|---|
| 782 | 656 | } |
|---|
| 783 | 657 | |
|---|
| 784 | 658 | static QETH_DEVICE_ATTR(vipa_del4, del4, 0200, NULL, |
|---|
| .. | .. |
|---|
| 795 | 669 | static ssize_t qeth_l3_dev_vipa_add6_store(struct device *dev, |
|---|
| 796 | 670 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 797 | 671 | { |
|---|
| 798 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 799 | | - |
|---|
| 800 | | - if (!card) |
|---|
| 801 | | - return -EINVAL; |
|---|
| 802 | | - |
|---|
| 803 | | - return qeth_l3_dev_vipa_add_store(buf, count, card, QETH_PROT_IPV6); |
|---|
| 672 | + return qeth_l3_vipa_store(dev, buf, true, count, QETH_PROT_IPV6); |
|---|
| 804 | 673 | } |
|---|
| 805 | 674 | |
|---|
| 806 | 675 | static QETH_DEVICE_ATTR(vipa_add6, add6, 0644, |
|---|
| .. | .. |
|---|
| 810 | 679 | static ssize_t qeth_l3_dev_vipa_del6_store(struct device *dev, |
|---|
| 811 | 680 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 812 | 681 | { |
|---|
| 813 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 814 | | - |
|---|
| 815 | | - if (!card) |
|---|
| 816 | | - return -EINVAL; |
|---|
| 817 | | - |
|---|
| 818 | | - return qeth_l3_dev_vipa_del_store(buf, count, card, QETH_PROT_IPV6); |
|---|
| 682 | + return qeth_l3_vipa_store(dev, buf, false, count, QETH_PROT_IPV6); |
|---|
| 819 | 683 | } |
|---|
| 820 | 684 | |
|---|
| 821 | 685 | static QETH_DEVICE_ATTR(vipa_del6, del6, 0200, NULL, |
|---|
| .. | .. |
|---|
| 868 | 732 | return 0; |
|---|
| 869 | 733 | } |
|---|
| 870 | 734 | |
|---|
| 871 | | -static ssize_t qeth_l3_dev_rxip_add_store(const char *buf, size_t count, |
|---|
| 872 | | - struct qeth_card *card, enum qeth_prot_versions proto) |
|---|
| 735 | +static ssize_t qeth_l3_rxip_store(struct device *dev, const char *buf, bool add, |
|---|
| 736 | + size_t count, enum qeth_prot_versions proto) |
|---|
| 873 | 737 | { |
|---|
| 738 | + struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 874 | 739 | u8 addr[16] = {0, }; |
|---|
| 875 | 740 | int rc; |
|---|
| 876 | 741 | |
|---|
| 877 | | - mutex_lock(&card->conf_mutex); |
|---|
| 878 | 742 | rc = qeth_l3_parse_rxipe(buf, proto, addr); |
|---|
| 879 | 743 | if (!rc) |
|---|
| 880 | | - rc = qeth_l3_modify_rxip_vipa(card, true, addr, |
|---|
| 744 | + rc = qeth_l3_modify_rxip_vipa(card, add, addr, |
|---|
| 881 | 745 | QETH_IP_TYPE_RXIP, proto); |
|---|
| 882 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 883 | 746 | return rc ? rc : count; |
|---|
| 884 | 747 | } |
|---|
| 885 | 748 | |
|---|
| 886 | 749 | static ssize_t qeth_l3_dev_rxip_add4_store(struct device *dev, |
|---|
| 887 | 750 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 888 | 751 | { |
|---|
| 889 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 890 | | - |
|---|
| 891 | | - if (!card) |
|---|
| 892 | | - return -EINVAL; |
|---|
| 893 | | - |
|---|
| 894 | | - return qeth_l3_dev_rxip_add_store(buf, count, card, QETH_PROT_IPV4); |
|---|
| 752 | + return qeth_l3_rxip_store(dev, buf, true, count, QETH_PROT_IPV4); |
|---|
| 895 | 753 | } |
|---|
| 896 | 754 | |
|---|
| 897 | 755 | static QETH_DEVICE_ATTR(rxip_add4, add4, 0644, |
|---|
| 898 | 756 | qeth_l3_dev_rxip_add4_show, |
|---|
| 899 | 757 | qeth_l3_dev_rxip_add4_store); |
|---|
| 900 | 758 | |
|---|
| 901 | | -static ssize_t qeth_l3_dev_rxip_del_store(const char *buf, size_t count, |
|---|
| 902 | | - struct qeth_card *card, enum qeth_prot_versions proto) |
|---|
| 903 | | -{ |
|---|
| 904 | | - u8 addr[16]; |
|---|
| 905 | | - int rc; |
|---|
| 906 | | - |
|---|
| 907 | | - mutex_lock(&card->conf_mutex); |
|---|
| 908 | | - rc = qeth_l3_parse_rxipe(buf, proto, addr); |
|---|
| 909 | | - if (!rc) |
|---|
| 910 | | - rc = qeth_l3_modify_rxip_vipa(card, false, addr, |
|---|
| 911 | | - QETH_IP_TYPE_RXIP, proto); |
|---|
| 912 | | - mutex_unlock(&card->conf_mutex); |
|---|
| 913 | | - return rc ? rc : count; |
|---|
| 914 | | -} |
|---|
| 915 | | - |
|---|
| 916 | 759 | static ssize_t qeth_l3_dev_rxip_del4_store(struct device *dev, |
|---|
| 917 | 760 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 918 | 761 | { |
|---|
| 919 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 920 | | - |
|---|
| 921 | | - if (!card) |
|---|
| 922 | | - return -EINVAL; |
|---|
| 923 | | - |
|---|
| 924 | | - return qeth_l3_dev_rxip_del_store(buf, count, card, QETH_PROT_IPV4); |
|---|
| 762 | + return qeth_l3_rxip_store(dev, buf, false, count, QETH_PROT_IPV4); |
|---|
| 925 | 763 | } |
|---|
| 926 | 764 | |
|---|
| 927 | 765 | static QETH_DEVICE_ATTR(rxip_del4, del4, 0200, NULL, |
|---|
| .. | .. |
|---|
| 938 | 776 | static ssize_t qeth_l3_dev_rxip_add6_store(struct device *dev, |
|---|
| 939 | 777 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 940 | 778 | { |
|---|
| 941 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 942 | | - |
|---|
| 943 | | - if (!card) |
|---|
| 944 | | - return -EINVAL; |
|---|
| 945 | | - |
|---|
| 946 | | - return qeth_l3_dev_rxip_add_store(buf, count, card, QETH_PROT_IPV6); |
|---|
| 779 | + return qeth_l3_rxip_store(dev, buf, true, count, QETH_PROT_IPV6); |
|---|
| 947 | 780 | } |
|---|
| 948 | 781 | |
|---|
| 949 | 782 | static QETH_DEVICE_ATTR(rxip_add6, add6, 0644, |
|---|
| .. | .. |
|---|
| 953 | 786 | static ssize_t qeth_l3_dev_rxip_del6_store(struct device *dev, |
|---|
| 954 | 787 | struct device_attribute *attr, const char *buf, size_t count) |
|---|
| 955 | 788 | { |
|---|
| 956 | | - struct qeth_card *card = dev_get_drvdata(dev); |
|---|
| 957 | | - |
|---|
| 958 | | - if (!card) |
|---|
| 959 | | - return -EINVAL; |
|---|
| 960 | | - |
|---|
| 961 | | - return qeth_l3_dev_rxip_del_store(buf, count, card, QETH_PROT_IPV6); |
|---|
| 789 | + return qeth_l3_rxip_store(dev, buf, false, count, QETH_PROT_IPV6); |
|---|
| 962 | 790 | } |
|---|
| 963 | 791 | |
|---|
| 964 | 792 | static QETH_DEVICE_ATTR(rxip_del6, del6, 0200, NULL, |
|---|