Revision c54ed5bc net/slirp.c
b/net/slirp.c | ||
---|---|---|
240 | 240 |
nc = qemu_new_net_client(&net_slirp_info, vlan, NULL, model, name); |
241 | 241 |
|
242 | 242 |
snprintf(nc->info_str, sizeof(nc->info_str), |
243 |
"net=%s, restricted=%c", inet_ntoa(net), restricted ? 'y' : 'n'); |
|
243 |
"net=%s,restrict=%s", inet_ntoa(net), |
|
244 |
restricted ? "on" : "off"); |
|
244 | 245 |
|
245 | 246 |
s = DO_UPCAST(SlirpState, nc, nc); |
246 | 247 |
|
... | ... | |
689 | 690 |
const char *bootfile; |
690 | 691 |
const char *smb_export; |
691 | 692 |
const char *vsmbsrv; |
693 |
const char *restrict_opt; |
|
692 | 694 |
char *vnet = NULL; |
693 | 695 |
int restricted = 0; |
694 | 696 |
int ret; |
... | ... | |
702 | 704 |
smb_export = qemu_opt_get(opts, "smb"); |
703 | 705 |
vsmbsrv = qemu_opt_get(opts, "smbserver"); |
704 | 706 |
|
707 |
restrict_opt = qemu_opt_get(opts, "restrict"); |
|
708 |
if (restrict_opt) { |
|
709 |
if (!strcmp(restrict_opt, "on") || |
|
710 |
!strcmp(restrict_opt, "yes") || !strcmp(restrict_opt, "y")) { |
|
711 |
restricted = 1; |
|
712 |
} else if (strcmp(restrict_opt, "off") && |
|
713 |
strcmp(restrict_opt, "no") && strcmp(restrict_opt, "n")) { |
|
714 |
error_report("invalid option: 'restrict=%s'", restrict_opt); |
|
715 |
return -1; |
|
716 |
} |
|
717 |
} |
|
718 |
|
|
705 | 719 |
if (qemu_opt_get(opts, "ip")) { |
706 | 720 |
const char *ip = qemu_opt_get(opts, "ip"); |
707 | 721 |
int l = strlen(ip) + strlen("/24") + 1; |
... | ... | |
720 | 734 |
vnet = qemu_strdup(qemu_opt_get(opts, "net")); |
721 | 735 |
} |
722 | 736 |
|
723 |
if (qemu_opt_get(opts, "restrict") && |
|
724 |
qemu_opt_get(opts, "restrict")[0] == 'y') { |
|
725 |
restricted = 1; |
|
726 |
} |
|
727 |
|
|
728 | 737 |
qemu_opt_foreach(opts, net_init_slirp_configs, NULL, 0); |
729 | 738 |
|
730 | 739 |
ret = net_slirp_init(vlan, "user", name, restricted, vnet, vhost, |
Also available in: Unified diff